In the work, encountered the picture conversion problem, encountered a few concepts, looked up some data, in this record.

  • Origin
  • My GitHub


The full name of ASCII is American Standard Code for Information Interchange (American Standard Information Interchange Code), which is the character coding Standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character encodings are based on ASCII, although they support many other characters.

ASCII evolved from telegraph codes. The first commercial use was the 7-bit teletype code popularized by Bell Data Services. Work on the ASCII standard began on October 06, 1963, 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 released, with major revisions in 1967 and the most recent update in 1986. The recommended Bell and ASCII codes were designed to make it easier to sort lists than earlier telegraph codes, and to add some functionality to devices other than teletypewriters.

Originally based on the English alphabet, ASCII encodes 128 specific characters as 7-bit integers, as shown in the chart below. The corresponding characters can be seen here.

The 95 encoded characters are printable. These characters include: 0-9, A-Z, A-Z, and punctuation. In addition, the original ASCII specification included 33 non-print control codes derived from the teletype machine. Most of these have fallen into disuse, although some, such as carriage returns, line feeds, and TAB codes, remain in common use.

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


Base64 is a set of encoding scheme similar to binary to text, in which a string representing binary in ASCII is converted to a representation of Base64. The term BASE64 derives from MIME content conversion 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 chosen to represent the 64-bit value of the cardinality varies by implementation. The usual strategy is to select 64 characters that are mostly used and printable. This combination makes data less likely to be modified as it travels between information systems, such as mail, which is not traditionally a standard 8-bit code. For example, the Base64 implementation of MIME uses A-Z, A-Z, and 0-9 as the first 62 values. Other variants share this feature, but the last two values differ in their choice of symbol. One example is UTF-7.

The earliest implementation of this encoding was to create dial-up communication between the same operating system. So you can make more assumptions about which characters are safe to use. For example, the uuencode tool uses lowercase characters, numbers, and many punctuation characters, but does not use lowercase.

The following is an implementation of Base64.

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

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

The resources

  • base64
  • ASCII Code