primers

In the work, encountered the problem of picture conversion, encountered several concepts, looked up some information, here to record.

ASCII

ASCII stands for American Standard Code for Information Interchange, a character encoding Standard used in electronic communications. ASCII represents text in computers, telecommunications equipment, and other devices. Most modern character encodings are based on ASCII, although they support many other characters.

ASCII developed from telegraph code. The first commercial use was the 7-bit teleprinter code popularized by Bell Data Services. Work on the ASCII standard began on October 06, 1960, when the American Standards Institute (ASA) (now the American National Standards Institute or ANSI) X3.2 Subcommittee held its first meeting. In 1963, the first version of the standard was published, with major revisions in 1967 and the most recent update in 1986. Both bell and ASCII codes were recommended for easier list sorting and added functionality to devices other than teletypewriters, as opposed to earlier telegraphic codes.

Originally based on the English alphabet, ASCII encodes 128 specific characters as 7-bit integers, as shown in the chart below, which corresponds here.

Ninety-five encoded characters are printable, including: 0-9, A-Z, A-Z, and punctuation. In addition, the original ASCII specification included 33 non-print control codes, derived from teletypes. Most of these are obsolete, although some are still in common use, such as carriage returns, line feeds, and TAB code.

For example, the lowercase letter I is represented in ASCII as 11001001 in binary, 69 in hexadecimal, and 105 in decimal.

Base64

Base64 is a set of binary-to-text encoding schemes that convert strings representing binary in ASCII to base-64 representations. The term Base64 comes from MIME content transformation encoding. Each Base64 digit represents exactly six bits of data. Three 8-bit bytes can be represented by four 6-bit Base64 digits.

The specific set of 64 characters selected to represent the 64-bit value of the cardinality varies from implementation to implementation. The usual strategy is to select 64 mostly used and printable characters. This combination makes it less likely that data will be modified as it travels between information systems, such as mail, which is traditionally not standard 8-bit encoding. For example, MIME’s Base64 implementation uses a-z, A-z, and 0-9 as the first 62 values. Other variants also share this feature, but the last two values differ in the selection of symbols, in one case UTF-7.

The earliest implementation of this code was to create dial-up communication between the same operating systems. More assumptions can therefore be made about which characters are safe to use. For example, the uuencode tool uses lowercase characters, numbers, and many punctuation characters, but not lowercase.

The following is one of the Base64 implementations.

Index Char Index Char Index Char Index Char
0 A 16 Q 32 g 48 w
1 B 17 R 33 h 49 x
2 C 18 S 34 i 50 y
3 D 19 T 35 j 51 z
4 E 20 U 36 k 52 0
5 F 21 V 37 l 53 1
6 G 22 W 38 m 54 2
7 H 23 X 39 n 55 3
8 I 24 Y 40 o 56 4
9 J 25 Z 41 p 57 5
10 K 26 a 42 q 58 6
11 L 27 b 43 r 59 7
12 M 28 c 44 s 60 8
13 N 29 d 45 t 61 9
14 O 30 e 46 u 62 +
15 P 31 f 47 v 63 /

The sample

Source Text (ASCII) M a n
Octets 77 (0x4d) 97 (0x61) 110 (0x6e)
Bits 0 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 1 1 1 0
Base64

encoded
Sextets 19 22 5 46
Character T W F u
Octets 84 (0x54) 87 (0x57) 70 (0x46) 117 (0x75)

The resources

more

This work makes me feel magical.