Unbreakable Cipher
Secret Writing: A History of Codes, Ciphers and Codebreaking
Course 1 · Chapter 5 · Unbreakable Cipher
Chapter 4 ended with Alberti's big idea: change the alphabet partway through a message so that letter counting stops working. This chapter follows that idea to its most famous form, a cipher so respected that it was called unbreakable for about three hundred years, and then to the two men who showed, independently, that it was not.
From Alberti to a Keyword
Alberti's disk needed the secretary to turn the dial at the right moments, which was slow and easy to get wrong. Later writers on ciphers found a neater way: agree on a keyword and let each letter of the keyword choose the shift for the matching letter of the message. Repeat the keyword as often as needed. The result is a series of Caesar shifts (Chapter 2) taken in rotation, which makes it polyalphabetic without any moving parts.
Blaise de Vigenere (1523 to 1596): French diplomat whose treatise on ciphers (1586) gave the method the name it still carries.
Charles Babbage (1791 to 1871): English mathematician and inventor of mechanical calculating engines, who broke the cipher privately in the 1850s.
Friedrich Kasiski (1805 to 1881): Prussian army officer who published a general method for breaking it in 1863.
How the Keyword Cipher Works
Number the alphabet A = 0, B = 1 and so on to Z = 25. To encipher, add the keyword letter's number to the message letter's number and wrap around after Z. To decipher, subtract. Spaces and punctuation are skipped, and the keyword does not advance over them.
Look at the three As in the message. They became L, O and E. The two Ts became X and F. This is exactly what Chapter 4 promised: a single plain letter no longer maps to a single cipher letter, so the frequency peak that Al-Kindi's method (Chapter 3) depends on is flattened out.
Le Chiffre Indechiffrable
A cipher that defeats letter counting looked, to its users, like a cipher that defeats everything. For roughly three centuries it carried the reputation of being le chiffre indechiffrable, French for "the indecipherable cipher". It still spread slowly: like Alberti's disk it was fiddly by hand, one slipped letter spoils everything after it, and nomenclators (Chapter 4) were quick and good enough. But for anyone who wanted real strength it was the cipher to use, and its reputation outlived its security.
| Cipher | Alphabets used | Letter counting works? | What breaks it |
|---|---|---|---|
| Caesar shift | One (fixed shift) | Yes, immediately | Trying all 25 shifts |
| Simple substitution | One (scrambled) | Yes (Al-Kindi) | Frequency analysis |
| Nomenclator | One plus a code list | Partly | Stolen code list, probable words |
| Keyword (Vigenere) | As many as the keyword has letters | No, not directly | Find the key length, then count each column |
The Weakness Hidden in the Repeat
The keyword has to repeat, and repetition is a pattern. Suppose the same word appears twice in the message and the two copies sit a whole number of keyword-lengths apart. Then both copies meet the same keyword letters and turn into the same cipher text. An analyst who spots a repeated group of letters in the cipher text has found a clue about the key.
The Breakers: Babbage and Kasiski
The break comes in two steps.
- Find the key length. Note the gaps between repeated groups of three or more letters. The key length must divide most or all of those gaps. Gaps of 12, 18 and 30 share the factors 2, 3 and 6, so the key is probably 3 or 6 letters long. This is the Kasiski examination.
- Split and count. If the key has 3 letters, every third letter of the cipher text was enciphered with the same shift. So the cipher text splits into three separate Caesar-shifted texts, and each one yields to ordinary letter counting. The commonest letter in each column is probably E, which reveals that column's shift and therefore the keyword letter.
Babbage is reported to have solved it in the 1850s, apparently after a challenge about the cipher was put to him, but he did not publish. Kasiski published a general method in 1863 and his name stuck to it. The moral for this course is that the cipher stood unchallenged less because it was strong than because few people seriously attacked it, and because the attackers who succeeded did not always say so.
What the Break Teaches
A cipher is only as strong as the weakest pattern it leaves behind. The keyword cipher hid letter frequencies but left the keyword's period visible. Once the period is known, the cipher collapses into several easy ones. The longer the key, the fewer repeats there are and the harder they are to find, which points toward a limit: if the key were as long as the message and never reused, there would be no period at all. Chapter 10 returns to that idea.
LXFOPV EF RNHR
What does it say?Show the worked answer
L (11) minus L (11) is 0, an A. X (23) minus E (4) is 19, a T. F (5) minus M (12) is minus 7, which wraps to 19, another T. Carry on in the same way and the message is ATTACK AT DAWN. Notice that the first three cipher letters L, X, F stand for A, T, T: the two Ts came out as different letters, which is why counting alone would not have helped you.
Where This Leaves the Secret Writer
By the nineteenth century the keyword cipher was both famous and broken, and a lesson was set: strength claims need testing by determined opponents. The next chapter turns from the method to the people, with spymasters, plots and the ciphers that sent a queen to the scaffold.
Exercises
Encipher RETREAT AT MIDNIGHT with the keyword BAD (B = 1, A = 0, D = 3), skipping spaces without advancing the keyword. (a) Write the cipher text. (b) Which plain letters in RETREAT became the same cipher letters as each other, and why?
Decipher DLC PPCOX QKMJC ER XSMX, which was enciphered with the keyword KEY (K = 10, E = 4, Y = 24). Then look at the two Ps at the start of PPCOX: do they stand for the same plain letter?
Here is a cipher text with spaces kept for reading: VHX MIGI SXPDL VHX IOEF AGF TAG SAKPL VHX PEQV MHTNBPG. (a) Find the group VHX and count the letters between its first and second appearances. (b) Find the gaps for the other appearances and decide what key lengths fit. (c) Given the key is CAT, decipher the message.
Quick Reference
- Keyword cipher: each keyword letter gives the shift for the matching message letter, repeated in rotation
- Encipher: add the numbers (A = 0 to Z = 25) and wrap around; decipher by subtracting
- Why it lasted: it flattens letter frequencies, so simple counting fails
- Kasiski examination: gaps between repeated groups reveal the key length
- Then: split into columns by key length and count letters in each
- Check: the names, dates and roles, and why Babbage did not publish
Next chapter: Mary, Queen of Scots and Spymasters, with the Babington plot, Walsingham's phasing and the Great Cipher of Louis XIV.