Skip to content
CryptoVault

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.

  1. I.1Transposition
  2. I.2Caesar cipher
  3. I.3Substitution and frequency analysis
  4. I.4Vigenère cipher
  5. I.5Enigma
  6. I.6One-time pad

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.

the rodHELPMEIAMUNDERATTACKturn123454letters per turnunwindHENTturn 1EIDTturn 2LAEAturn 3PMRCturn 4MUAKturn 5
Each column is one turn of the strip. Unwound, it carries the same letters in a scrambled order.
The order is hidden, the letters are not: the ciphertext still has English’s Es, Ts and As.

Caesar cipher

Shift every letter by the same amount. The amount is the key.

plaintext letterk = 3ABCDEFGHIJKLMNOPQRSTUVWXYZDEFGHIJKLMNOPQRSTUVWXYZABCciphertext letterVENI VIDI VICI → YHQL YLGL YLFL
PitfallTwenty-five keys is no secret: try them all and read the one that makes sense.

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.

letters of Englishsymbols in the ciphertextETAOINTZQGOFsubstituteE → T, T → Z…
Substitution relabels the bars but keeps their shape. The tallest symbol in the ciphertext is almost certainly E.
Try it: break an intercept by counting

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.

A huge key space is not enough. If the structure of the plaintext survives, the cipher is broken.

Vigenère cipher

A keyword switches between several Caesar shifts, so the same letter encrypts differently and frequencies flatten out.

plainATTACKATDAWNthe key, 5 letters, then againkeyLEMONLEMONLEcipherLXFOPVEFRNHRcipher = plain + key letter (A = 0, B = 1, …), mod 26
The four As come out as L, O, E, N: one letter, four disguises. But the key repeats every 5 letters, so every 5th letter shares a Caesar shift.

Kasiski (1863) measured the distance between repeated fragments to get the key length. Then each column is a Caesar cipher, broken by counting.

Repetition is the enemy. A repeating key gives the attacker columns to count.

Enigma

A rotor machine whose substitution changes with every key press, broken by Polish mathematicians and then at industrial scale at Bletchley Park.

plugboardrotor IIIat Brotor IIat Arotor Iat AreflectorAkeyBlampAACDFSSEBB
Pressing A, rotor III first steps to B. The current runs out and back on two different wires, so a letter can never light its own lamp.

The army’s daily settings gave about 1.6 × 1020 keys (≈ 267).

Try it: an Enigma I, wired like the original
AAArotors I, II, III

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.

Enigma fell to a design flaw, predictable messages and operator habits, never to a search of its keys.

One-time pad

Add a truly random key as long as the message and never use it again: the only cipher proven unbreakable.

intercepted ciphertextEQNVZminus padminus padpadXMCKLreadsHELLOpadTQURIreadsLATER
With a random pad, EQNVZ is just as consistent with HELLO as with LATER. The ciphertext alone carries no information.

Shannon proved it in 1949, along with the price: at least as much random key as message, delivered in advance.

PitfallReuse a pad and subtracting the two ciphertexts cancels it, leaving two plaintexts mixed together. That is how the Venona project read Soviet traffic.

In one breath

  1. Transposition. Keep the letters, scramble their order.
  2. Caesar cipher. Shift every letter by the same amount. The amount is the key.
  3. 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.
  4. Vigenère cipher. A keyword switches between several Caesar shifts, so the same letter encrypts differently and frequencies flatten out.
  5. Enigma. A rotor machine whose substitution changes with every key press, broken by Polish mathematicians and then at industrial scale at Bletchley Park.
  6. One-time pad. Add a truly random key as long as the message and never use it again: the only cipher proven unbreakable.