Some of the more mathematical methods of encryption that we'll discuss are best described in terms of transformations of integers into other integers. For the more interesting encodings, it really doesn't matter how you do this translation, but certain methods have slight advantages over others.
The most common method is probably the ASCII encoding that assigns a number to each character. The standard ASCII encoding specifies 128 different characters (including not only the standard upper and lower case letters and the digits, but all the punctuation, some control characters, and various other things.
Here is the standard ASCII encoding. The numbers on the sides and top
are in octal (base 8) and need to be combined. For example, the character
``S'' is in row 12, column 3. It's ASCII octal number is thus 123. To
convert to base 10, 123 (octal)
83 (decimal). 040 (octal) is the space character;
177 (octal) is the ``delete'' character.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
| 00 | ^ |
^ |
^ |
^ |
^ |
^ |
^ |
^ |
| 01 | ^ |
^ |
^ |
^ |
^ |
^ |
^ |
^ |
| 02 | ^ |
^ |
^ |
^ |
^ |
^ |
^ |
^ |
| 03 | ^ |
^ |
^ |
^ |
^ |
^ |
^ |
^ |
| 04 | ! | '' | # | $ | % | & | ' | |
| 05 | ( | ) | * | + | , | - | . | / |
| 06 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 07 | 8 | 9 | : | ; | |
= | |
? |
| 10 | @ | A | B | C | D | E | F | G |
| 11 | H | I | J | K | L | M | N | O |
| 12 | P | Q | R | S | T | U | V | W |
| 13 | X | Y | Z | [ | |
] | ^ | _ |
| 14 | ` | a | b | c | d | e | f | g |
| 15 | h | i | j | k | l | m | n | o |
| 16 | p | q | r | s | t | u | v | w |
| 17 | x | y | z | { | |
} | |
DEL |
The ASCII assignments are for the numbers from 0 to 127, which require 7 bits of data. The standard character on a computer (one byte) is 8 bits of data, which can represent a number from 0 to 255. When ASCII encoding is used, each character is put in one byte, so effectively, one bit of each character is wasted.
But the nice thing about a numeric representation that packs into 7 or 8 bits is that the numeric representations can simply be concatenated to make representations of groups of letters. If you wish to encode two ASCII characters at once, simply place their binary representations next to each other, and you get a 16 bit number (between 0 and 65535). If you don't understand this, imagine that you are working in base 10, and you have a character set that encodes to a number between 00 and 99. Then if ``A'' happened to be 17 and ``Z'' were 42, then the character pair ``AZ'' would be the four-digit number 1742.
Binary representations work great on a computer, but since many people find base 10 much easier to work with than base 2, the numeric examples in this paper will use the following encoding:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
| 0 | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX |
| 1 | SP | A | B | C | D | E | F | G | H | I |
| 2 | J | K | L | M | N | O | P | Q | R | S |
| 3 | T | U | V | W | X | Y | Z | a | b | c |
| 4 | d | e | f | g | h | i | j | k | l | m |
| 5 | n | o | p | q | r | s | t | u | v | w |
| 6 | x | y | z | . | , | : | ; | ' | `` | ` |
| 7 | ! | @ | # | $ | % | ^ | & | * | - | + |
| 8 | ( | ) | [ | ] | { | } | ? | / | |
|
| 9 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
The entries with XX are not used, and ``SP'' is the space character. Thus all characters code to between 10 and 99. ``U'' is 31; ``5'' is 95, and so on. If we want to encode four characters at a time, for example, we would encode the word ``C3PO'' as the 8-digit number 13932625.