Suppose that the letters (and some characters) are converted to binary as follows.
char | a | b | c | d | e | f | g | h |
number | 00000 | 00001 | 00010 | 00011 | 00100 | 00101 | 00110 | 00111 |
char | i | j | k | l | m | n | o | p |
number | 01000 | 01001 | 01010 | 01011 | 01100 | 01101 | 01110 | 01111 |
char | q | r | s | t | u | v | w | x |
number | 10000 | 10001 | 10010 | 10011 | 10100 | 10101 | 10110 | 10111 |
char | y | z | . | , | ( | ) | ? | @ |
number | 11000 | 11001 | 11010 | 11011 | 11100 | 11101 | 11110 | 11111 |
Then the plaintext message
heilhitler
becomes the plaintext bit string
00111,00100,01000,01011,00111,01000,10011,01011,00100,10001
Suppose we generate the random bitstring
10100,11000,10111,10000,00010,11101,11001,11010,10111,11011
and XOR the corresponding bits of this random string with the
message above. The result is
10011,11100,11111,11011,00101,10101,01010,10001,10011,01010
which corresponds to the message
t(@,fvkrtk
Anyone who has the random bit string can recover the message, while anyone who does not have the random bit string has no information about the text. Unlike any other cryptosystem, the one-time pad offers provable (or perfect) security, provided that the key is only used once.
However, if we want to get the sender in trouble with his friends,
we could claim that the secret random bit string was instead
10100,11100,10010,11101,00010,11101,11001,11010,10111,11011
in which case the message would "decrypt" as
hanghitler