2010-09-24 17:24:43 -06:00
|
|
|
ASCII
|
|
|
|
=====
|
|
|
|
|
|
|
|
ASCII is a map of 7-bit values--0x00 through 0x7F--to glyphs (printable
|
|
|
|
characters). Here is the ASCII chart from the Linux ASCII(7) man page:
|
|
|
|
|
|
|
|
0 1 2 3 4 5 6 7
|
|
|
|
-----------------
|
|
|
|
0: ␀ ␐ 0 @ P ` p
|
|
|
|
1: ␁ ␑ ! 1 A Q a q
|
|
|
|
2: ␂ ␒ " 2 B R b r
|
|
|
|
3: ␃ ␓ # 3 C S c s
|
|
|
|
4: ␄ ␔ $ 4 D T d t
|
|
|
|
5: ␅ ␕ % 5 E U e u
|
|
|
|
6: ␆ ␖ & 6 F V f v
|
|
|
|
7: ␇ ␗ ' 7 G W g w
|
|
|
|
8: ␈ ␘ ( 8 H X h x
|
|
|
|
9: ␉ ␙ ) 9 I Y i y
|
|
|
|
A: ␊ ␚ * : J Z j z
|
|
|
|
B: ␋ ␛ + ; K [ k {
|
|
|
|
C: ␌ ␜ , < L \ l |
|
|
|
|
D: ␍ ␝ - = M ] m }
|
|
|
|
E: ␎ ␞ . > N ^ n ~
|
|
|
|
F: ␏ ␟ / ? O _ o ␡
|
|
|
|
|
|
|
|
Characters 0x00 through 0x1F and character 0x7F are the so-called
|
|
|
|
"control characters" and are typically not displayed.
|
|
|
|
|
|
|
|
So, the following sequence of hex values:
|
|
|
|
|
|
|
|
68 65 6C 6C 6F 20 77 6F 72 6C 64 2E
|
|
|
|
|
|
|
|
when decoded as ASCII yields the string:
|
|
|
|
|
|
|
|
hello world
|
|
|
|
|
|
|
|
|
|
|
|
Base 64
|
|
|
|
=======
|
|
|
|
|
|
|
|
Base 64 is a map of 6-bit values--0x00 through 0x3F--to ASCII
|
|
|
|
characters. Here is the Base 64 alphabet:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
---------
|
|
|
|
0: A Q g w
|
|
|
|
1: B R h x
|
|
|
|
2: C S i y
|
|
|
|
3: D T j z
|
|
|
|
4: E U k 0
|
|
|
|
5: F V l 1
|
|
|
|
6: G W m 2
|
|
|
|
7: H X n 3
|
|
|
|
8: I Y o 4
|
|
|
|
9: J Z p 5
|
|
|
|
A: K a q 6
|
|
|
|
B: L b r 7
|
|
|
|
C: M c s 8
|
|
|
|
D: N d t 9
|
|
|
|
E: O e u +
|
|
|
|
F: P f v /
|
|
|
|
|
|
|
|
The following sequence of hex values:
|
|
|
|
|
|
|
|
00 00 12 2F 3C 07
|
|
|
|
|
|
|
|
when encoded as Base 64 yields the ASCII string:
|
|
|
|
|
|
|
|
AASv8H
|
|
|
|
|
|
|
|
|
|
|
|
6-bit values in an 8-bit world
|
|
|
|
==============================
|
|
|
|
|
|
|
|
Modern computers, almost universally, use an 8-bit byte. Base64 is used
|
|
|
|
to map an 8-bit byte stream to a set of 64 universally printable
|
|
|
|
characters.
|
|
|
|
|
|
|
|
In order to do this, the 8-bit *byte* stream must be converted into a
|
|
|
|
*bit* stream. This bit stream must then be converted into a stream of
|
|
|
|
6-bit bytes, as in the following figure:
|
|
|
|
|
2010-10-12 16:58:34 -06:00
|
|
|
| 00 | 04 | AF | F0 | 74 | 14 |
|
2010-09-24 17:24:43 -06:00
|
|
|
| | | | | | |
|
2010-10-12 16:58:34 -06:00
|
|
|
|000000 00|0000 0100|10 101111|111100 00|0111 0100|00 010100|
|
2010-09-24 17:24:43 -06:00
|
|
|
| |
|
2010-10-12 16:58:34 -06:00
|
|
|
|000000|00 0000|0100 10|101111|111100|00 0111|0100 00|010100|
|
2010-09-24 17:24:43 -06:00
|
|
|
| | | | | | | | |
|
|
|
|
| 00 | 00 | 12 | 2F | 3C | 07 | 10 | 14 |
|
|
|
|
|
|
|
|
The resulting 6-bit byte stream is then mapped into the ASCII alphabet
|
|
|
|
given in the previous section, resulting in a "Base64-encoded string":
|
|
|
|
|
|
|
|
AASv8HQU
|
|
|
|
|
|
|
|
|
|
|
|
Question
|
|
|
|
========
|
|
|
|
|
|
|
|
The key for this page is the decode of this Base64-encoded string:
|
|
|
|
|
|
|
|
Z3JlYXQgam9i
|