Cryptography and Cryptanalysis

Cryptography and Cryptanalysis
The word "cryptography" comes from the Greek roots meaning "hidden writing".
Cryptography is the art of creating codes and ciphers, ways of making a message
understandable to only a select group of people, while cryptanalysis is the art of figuring
out how to read this "hidden writing". Codes are basically secret languages, and you
simply only give dictionaries to the people that you want to be able to read them. They
tend to be very difficult to figure out without gaining access to the secret dictionary.
Today, our attention will be focused on ciphers, which are ways of scrambling messages
instead of translating them. The simplest ciphers involve shifting the letters of the
alphabet by some number. For example, below to the left, I replace every letter with the
letter 3 letters after it in the alphabet, a --> D, b--> E... looping back to ABC after Z.
a ---> D
Julius Caesar was one of the first people to use ciphers such as this for
b ---> E
military communications. With the English alphabet, there are only a few
c ---> F
ways to do this, so it is a very easy cipher to crack: just check each one.
d ---> G
These are examples of substitution ciphers, ways of simply replacing
e ---> H
letters with different ones. Clearly, there are many substitution ciphers,
f ---> I
so you can no longer hope to simply check them all (the so-called "brute
g ---> J
force" method). However, there are still ways to crack such ciphers with
h ---> K
relative ease using a method first devised by the medieval Arab scholar
i ---> L
al-Kindi, now called frequency analysis. The idea is very simple: use what
j ---> M
you know about the language being encrypted to crack the cipher! For
k ---> N
example, in English, the letters "e", "t", and "a" occur most often while
l ---> O
"j", "q", "x", and "z" occur least often. We also know something about
m ---> P
how some pairs of letters, or digraphs, are distributed. For example, "ee" is
n ---> Q
common, but how many words have "aa" or "ii"? Just think of common
o ---> R
digraphs and use this to help you break the cipher. Also, sometimes the
p ---> S
message will have a certain form to it, such as a letter starting with "Dear".
q ---> T
Sometimes, a message will use the word "stop" at the end of a sentence.
r ---> U
Other kinds of ciphers involve physically scrambling the message. For
s ---> V
example, the ancient Spartans used to wrap a strip of parchment around
t ---> W
a stick and then write the message vertically down the stick. When they
u ---> X
unwrapped it, the message would look like nonsense to anyone who didn't
v ---> Y
know to wrap it around a stick of the same diameter. You can usually tell
w ---> Z
that a transposition cipher has been used if frequency analysis gives the
x ---> A
same distribution of letters as in a normal sample of the language ("e"
y ---> B
very common, etc.). You might have fun coming up with your own cipher
z ---> C
to use in sending messages to your friends.