Our workshop probably won't get to every item in this outline, but
this should give you some idea of the material we propose to cover,
and the order in which we will consider the topics.
I. Definitions
Code vs. cipher. A code works at the level of
words, a cipher at the level of letters.
Encryption and decryption. We use a system
and (usually) a key to map from plaintext to
ciphertext and vice versa.
Cryptanalysis. Breaking a cipher -- guessing the method
and the key -- is quite different from simple decryption.
Substitution and transposition. Most of the
ciphers we will study fall into one of these two broad categories.
II. Monoalphabetic substitution ciphers
Shift ciphers -- Encryption and decryption.
Encryption and decryption by hand; use of a cipher wheel.
Mapping the alphabet to {0, ..., 25} and back.
Modular addition and subtraction; modular addition tables in
Excel.
Description of a shift and its inverse
in mathematical terms; encryption
and decryption in Excel. A shift cipher is implemented by adding a
constant to each plaintext letter, and its inverse by
subtracting the same constant.
Shift ciphers -- Cryptanalysis.
Constructing a frequency table.
Eyeball matching with a standard frequency histogram.
Affine ciphers -- Encryption and decryption.
Modular multiplication.
Modular multiplication tables in Excel.
One-to-one functions. The map xax mod m
(a dilation)
fails to be one-to-one when a and m have common
factors. Shifts are always one-to-one.
(Optional) GCDs and the Euclidean Algorithm. This is a
fairly quick way to determine whether two numbers have any
common factors.
Multiplicative inverses in modular arithmetic. We can find
these by looking through a multiplication table, or by a
simple extension of the Euclidean Algorithm.
Modular affine functions. As long as GCD(a,m)=1,
the map xax+b mod m
is one-to-one and
therefore invertible. We compare this with inversion of
ordinary linear functions.
Encryption and decryption of an affine cipher by hand. It's
not difficult to make an alphabet table for an affine cipher.
In fact, there's a nice short-cut, that also helps with
cryptanalysis of affine ciphers.
Encryption and decryption of an affine cipher using Excel.
Since we can find the formula for the inverse of an affine
function, we can set up spreadsheets for both encryption and
decryption.
Affine ciphers -- Cryptanalysis.
Frequency counts. We can guess at the most frequent
and least frequent letters, but the shape of the frequency
histogram will not be the same as the standard one.
Bigram and trigram frequency tables. Each letter's
"personality" lets us see through its
disguise.
Use of the cipher design in cryptanalysis.
The images of two plaintext letters may
determine the entire mapping, because we can sometimes solve
the system {c1 = ap1 + b, c2 =
ap2 + b} for a
and b.
Word-key substitution ciphers -- Encryption and decryption.
Creation of a word-key subsitution cipher.
Encryption and decryption of a word-key subsitution cipher
by hand. We simply make an alphabet table.
Word-key substitution ciphers -- Cryptanalysis.
Application of
frequency tables and bigram and trigram frequency tables to
idenfity letters in a word-key substitution cipher. Again,
the frequency histogram shape will be unfamiliar.
Use of the cipher design in breaking a word-key subsitution
cipher. The idea is to reconstruct the keyword.
(Optional) Cryptanalysis of monoalphabetic
substitution ciphers using cribs
and probable words.
Letter-frequency patterns.
Repeated-letter patterns.
Comparison of monoalphabetic substitution ciphers.
Complexities of the keys. A simple shift uses a
one-element key,
and the cipher is broken by fixing just one letter;
an affine code
uses a two-element key and may be broken by fixing as few as
two
letters; a word-key substitution cipher has a variable-length
key, and requires more work to break.
Discussion of a general monoalphabetic substitution
cipher.
The 26! permutations of {A, ..., Z}.
How do you remember a random key? Should a key be
memorized, or written down?
(Optional) Cycle notation and the order of a
permutation. If a permutation has order 2, then
encryption and decryption are identical.
Comparison of the times required to break substitution
ciphers by brute force.
(Optional) Using nulls to defeat frequency analysis.
III. Polyalphabetic substitution ciphers
The Vigenère cipher with a cyclic key -- Encryption and
decryption.
Vigenère encryption and decryption by hand. We use a
Vigenère table to do this.
Mathematical description of the (cyclic, standard) Vigenère
cipher. The mapping is
xx + k(t),
where k() is the
keyword and t is time.
(Optional) Implementation of the (cyclic, standard)
Vigenère cipher (and its inverse) in Excel. This requires
learning about some rather esoteric features of Excel.
The Vigenère cipher with a cyclic key -- Cryptanalysis.
Key length
Repeated cipher groups. The key length is probably a factor
of most of the distances between repeated cipher groups.
(Optional) Standard deviation of the frequency table. This
gives a (very) rough estimate of key length.
Separating the alphabets. We use the key length to reduce the
cyclic Vigenère to a monoalphabetic problem.
Using the cipher design in cryptanalysis. The standard
alphabet makes the monoalphabetic matchings easy, and the
keyword itself may provide clues to its own reconstruction.
Polyalphabetic ciphers with (cycling) non-standard alphabets.
Discussion of encryption and decryption procedures and
devices. This kind of cipher is well-suited to special tables
or mechanical devices.
Discussion of cryptanalysis techniques. As long as the
alphabet is constant, the techniques are not very different
from those use to break a standard Vigenère cipher.
(Optional) Cryptanalysis exercise.
Some other substitution ciphers.
Polyalphabetic ciphers with very long keys. These have to
depend on mechanical devices.
(Optional) Auto-key systems.
The Wheatstone device. An astonishingly simple machine
implements a substitution
cipher in which the alphabets move irregularly, and the cycle
of alphabets is the GCD of the sizes of two wheels.
(Optional) The Thomas Jefferson device.
(Optional) The Playfair cipher.
One-time pads. This is the one cipher that's completely
unbreakable, even in theory.
Demonstration of the unbreakability of a one-time pad.
(Optional) Use of a pseudo-random number generator to
implement a one-time pad. If two computers use the same
pseudo-random number generator with the same seed, then they
appear to implement one-time pad communication. It's
actually a Vigenère cipher with a very long key;
pseudo-random numbers aren't truly random.
(Optional) Discussion of why a one-time pad can't be used
more than once.
The Enigma machine. This is a polyalphabetic substitution
cipher with a very large number (263) of alphabets, but
each alphabet consists entirely of 2-cycles.
IV. Transposition ciphers (Optional)
Examples of transposition ciphers.
Fence-post and other rectangular ciphers.
Rectangular ciphers with keywords. A keyword is just a handy
way to remember a permutation of the rows or columns of the
grid.
The poem code. This is a transposition code used by the
Allied underground in World War II. We can reconstruct how it
works from an episode in Between Silk and Cyanide by
Leo Marks.
Transposition cipher cryptanalysis and security.
Recognition of a transposition cipher by frequency count. If
the frequency histogram looks like the standard one,
the cipher is probably
a transposition.
Factors of the ciphertext length. For a rectangular
transposition code, cryptanalysis begins by drawing a grid
with the correct dimensions.
Difficulty of breaking a rectangular transposition code. How
many possibilities are there?
V. Public-key cryptography
The notion of a public-key system. An on-line company
(olc) needs to
tell your computer how to encrypt your credit-card number
without revealing how to decrypt it.
Basic ideas from number theory.
Primes, the Fundamental Theorem of Arithmetic,
and the definition of
square-free. The public-key system uses
numbers that are products of two (distinct) primes.
The Euler
function.
Definition. The number
(m) is equal to
the number of elements of {1, ..., m-1} that have
multiplicative inverses modulo m. (From an earlier activity,
we know that this is the number of elements of {1, ...,
m-1} that have no common factors with m.)
Calculation. If m is prime, then
(m)
= m-1.
If m = pq is a product of (distinct) primes, then
(m)
= (p-1)(q-1).
Modular power tables. If m is square-free, then
every column in a mod-m power table
whose number is one more than a multiple
of (m)
contains the numbers 1 through m-1
in standard order.
Statement of Euler's Theorem:
If m is square-free, then
an(m)+1
mod m = a.
The Public-key cryptography system.
Preparation. The OLC obtains two primes, p and
q, and multiplies them together to get m =
pq. It chooses
a number k between 1 and m. (The number k must have
no common factors with
(m);
otherwise it is chosen
essentially at random.)
Encryption. The OLC tells your computer the numbers m
and k. Your computer takes your credit-card number x and
computes xk mod m.
Call this number y. Your computer
sends y back to the OLC.
Decryption. The OLC knows that m = pq,
so it can compute
(m)
= (p-1)(q-1).
It now finds a multiplicative inverse
for k modulo
(m);
that is, a number k' such that
kk' is one more than a multiple of
(m).
It computes
yk' mod m.
Since y= xk mod m,
the result is
(xk)k'm = xkk' mod m = x
by Euler's Theorem.
Example of public-key cryptography.
(Optional.) This history and alternate history of public-key
cryptography. There's a nice account in The Code Book by
Simon Singh.
The security of public-key cryptography. The decryption key,
k', is easy to compute (Euclid's algorithm) once you know k
and (m).
But how can you find
(m) from m?
Helen Fouché Gaines.
Cryptanalysis: A Study of Ciphers and their Solution.
Dover Publications, New York, 1939.
Gaines describes many of the classic transposition and substitution
ciphers, and provides detailed instructions for their cryptanalysis.
As you'd guess from the copyright date, this is all pencil-and-paper
stuff.
Martin Gardner.
Codes, Ciphers, and Secret Writing.
Dover Publications, New York, 1972.
This very friendly and relatively short book describes many
transposition and substitution ciphers, and includes a fascinating
chapter on invisible inks.
David Kahn.
The Codebreakers.
Macmillan, New York, 1967.
This twelve-hundred-page monster traces the use of codes and ciphers
throughout history (Western history, mostly). The historical accounts
are often gripping (they often include fascinating character
sketches),
and they are interspersed with very readable
discussions of the nuts and bolts of cryptographic techniques of each
historical period.
One caution, though: this is a big, long book.
David Kahn.
Seizing the Enigma:
The Race to break the German U-boat codes, 1939 - 1943.
Souvenir, London, 1992.
This is a very readable account of the
activities that allowed the Allies to read
a good deal of the communication between the
German command and the U-boat fleet during World War II.
The characters include brilliant cryptographers,
daring spies, and heroic soldiers;
the intertwining of so many disparate
people and events makes for fascinating reading.
The discussion of the Enigma code itself is sketchy,
but at least it's present.
Leo Marks.
Between Silk and Cyanide.
The Free Press, New York, 1998.
Marks worked for British intelligence during World War II, trying to
reconstruct messages that had been incorrectly enciphered or
incorrectly transmitted by underground agents working on the
Continent. This is the story of his years in that job, his
interactions with the agents, and his attempts to convince his
military superiors to switch to a more secure and more robust
encryption scheme. It reads like a novel -- sort of a combination of
a good spy thriller and Catch-22.
Ivan Niven, Herbert Zuckerman, and Hugh Montgomery.
An Introduction to the Theory of Numbers.
John Wiley & Sons, New York, fifth edition, 1991.
This is a standard textbook on Number Theory, aimed at the advanced
undergraduate or beginning graduate student level. It's a good
reference for the details behind public-key cryptography, and some of
the techniques that contemporary mathematicians use to attack the
problem of factoring products of large primes.
Simon Singh.
The Code Book.
Anchor Books, New York, 1999.
This is an excellent
and very readable
account of the history and practice of cryptography.
I recommend it highly.
Abraham Sinkov.
Elementary Cryptanalysis: A Mathematical Approach.
Random House and the L. W. Singer Company, New York, 1968.
The mathematics in this book is very clear and accessible.
The book covers
many of the same cryptanalysis techniques as the Gaines book, but
uses mathematical notation, so that the techniques can be generalized
and automated more easily.