Chapter I
Classical ciphers
Two thousand years of hiding letters, from Sparta to Enigma, and the one idea that broke almost every cipher: patterns survive.
Transposition
Keep the letters, scramble their order.
Wind a strip around a rod, write along it, unwind. Only a rod of the same thickness lines the letters up again.
Caesar cipher
Shift every letter by the same amount. The amount is the key.
Substitution and frequency analysis
Any letter may stand for any other, which gives 26! keys, yet the frequency of each letter still gives the cipher away.
A scrambled alphabet gives 26! ≈ 288 keys, far too many to try. Al-Kindi’s answer, in the 9th century: don’t search the keys, count the symbols.
Pgpcj wlyrflrp sld l qtyrpcactye. Ty Pyrwtds esp wpeepc P laaplcd lmzfe zyp etxp ty ptrse, qzwwzhpo mj E, L lyo Z, hstwp U, B, I lyo K lcp clcp. L ntaspc esle lwhljd cpawlnpd esp dlxp wpeepc mj esp dlxp djxmzw vppad esle qtyrpcactye tyelne, dz nzfyetyr djxmzwd td pyzfrs ez dpp esczfrs te.
Bars: letters of the decryption. Dashes: how often each letter appears in English.
Vigenère cipher
A keyword switches between several Caesar shifts, so the same letter encrypts differently and frequencies flatten out.
Kasiski (1863) measured the distance between repeated fragments to get the key length. Then each column is a Caesar cipher, broken by counting.
Enigma
A rotor machine whose substitution changes with every key press, broken by Polish mathematicians and then at industrial scale at Bletchley Park.
The army’s daily settings gave about 1.6 × 1020 keys (≈ 267).
Type a letter several times: it never lights up as itself.
Rejewski rebuilt the wiring in 1932 from the doubled message keys. At Bletchley Park, the Bombe tested settings against guessed words, cribs, using the rule above to rule positions out.
One-time pad
Add a truly random key as long as the message and never use it again: the only cipher proven unbreakable.
Shannon proved it in 1949, along with the price: at least as much random key as message, delivered in advance.
In one breath
- Transposition. Keep the letters, scramble their order.
- Caesar cipher. Shift every letter by the same amount. The amount is the key.
- Substitution and frequency analysis. Any letter may stand for any other, which gives 26! keys, yet the frequency of each letter still gives the cipher away.
- Vigenère cipher. A keyword switches between several Caesar shifts, so the same letter encrypts differently and frequencies flatten out.
- Enigma. A rotor machine whose substitution changes with every key press, broken by Polish mathematicians and then at industrial scale at Bletchley Park.
- One-time pad. Add a truly random key as long as the message and never use it again: the only cipher proven unbreakable.