Ancient Secrets
Secret Writing: A History of Codes, Ciphers and Codebreaking
Course 1 · Chapter 2 · Ancient Secrets
Chapter 1 gave you the vocabulary. This chapter puts it to work on the oldest ciphers we know of, each of which you can carry out with a pencil in a couple of minutes. They come from Sparta, Rome, ancient Israel, India and China, and they fall into two families that will run through the rest of the course: ciphers that move letters around, and ciphers that swap letters for other letters.
Two Families of Cipher
| Transposition | Substitution | |
|---|---|---|
| What it does | Keeps the same letters but changes their order | Keeps the order but replaces each letter |
| Ancient example | The Spartan scytale | Caesar shift, Atbash, the Indian "Kama Sutra" pairing |
| Letter counts | Unchanged: the same letters appear the same number of times | Changed: every letter is now disguised as another |
The Scytale: A Cipher You Can Hold
Greek writers describe the Spartan scytale (roughly "skytalee"), a wooden rod. A strip of leather or parchment was wound around it in a spiral, the message was written along the length of the rod, and the strip was then unwound. Off the rod, the strip showed only a jumble of letters. The recipient owned a rod of the same thickness, wound the strip back on and read the message across it.
The rod is the key. Today we would call this a transposition cipher: no letter is changed, only the order. You can imitate it with a grid, which is how the puzzle at the end of the chapter works.
The Caesar Shift
The Roman biographer Suetonius reports that Julius Caesar protected private letters by replacing each letter with the one three places further along the alphabet: A becomes D, B becomes E, and so on, wrapping around at the end so that X becomes A, Y becomes B and Z becomes C. The same idea with any shift is now called a Caesar cipher, and the shift is the key.
To decipher, shift the other way. Caesar's cipher was strong enough for its day mainly because most people could not read at all, and an enemy who could read still had to realise it was a cipher rather than a foreign language. As a system it is feeble: there are only 25 useful shifts, so anyone who suspects the method can simply try them all. That is the first lesson of cryptanalysis you will meet: a key that can be guessed by trying every possibility gives little protection.
Atbash: Reversing the Alphabet
Atbash is a Hebrew substitution in which the first letter of the alphabet swaps with the last, the second with the second-last, and so on. The name itself shows how it works: it is built from the Hebrew letters aleph, taw, beth and shin, the first, last, second and second-last letters. Scholars note that some Hebrew scriptural passages appear to use it; the best-known example is a name for Babylon in the Book of Jeremiah, usually written "Sheshach" and read as Babylon after the substitution.
The same idea works on the Latin alphabet, where A swaps with Z, B with Y and so on:
Atbash has no key at all: there is exactly one Atbash. Enciphering and deciphering are the same operation, which is neat, but anyone who knows the trick reads everything. It is a good example of Kerckhoffs's idea from Chapter 1 failing: the method is the only secret.
India and China
The Kama Sutra's pairing cipher
The Kama Sutra, an Indian text on the arts of life, lists among the skills to be learned a kind of secret writing known as mlecchita vikalpa. One method described in commentary is a pairing cipher: the alphabet is divided into pairs at random, and each letter is replaced by its partner. Atbash is the special case where the pairs are fixed by reversing the alphabet. A random pairing is better because there is now a key, the pairing, that has to be shared.
China
Chinese writing makes classic letter ciphers awkward, because it has thousands of characters rather than a short alphabet. Chinese military writers instead relied on codes (in the sense of Chapter 1): a list of agreed phrases standing for stock messages, and tokens split between commander and officer that had to match. The lesson is that the writing system itself shapes which kind of secrecy works best.
How Strong Were They?
| Cipher | Type | Number of keys | Main weakness |
|---|---|---|---|
| Scytale | Transposition | A few dozen sensible rod sizes | Try each size until text appears |
| Caesar shift | Substitution | 25 | Try every shift |
| Atbash | Substitution | 1 | No key; anyone who knows the method reads it |
| Random pairing | Substitution | Very many (more than any person could try) | Needs a cleverer attack: see Chapter 3 |
That last row points ahead. Once the number of possible keys is too large to try them all, you need a new idea to break the cipher, and it came from scholars in the Arab world, as Chapter 3 explains.
HVFDSH WR WKH ULYHU
Show the worked answer
Move each letter three places back: H→E, V→S, F→C, D→A, S→P, H→E gives ESCAPE; W→T, R→O gives TO; W→T, K→H, H→E gives THE; U→R, L→I, Y→V, H→E, U→R gives RIVER. The plaintext is ESCAPE TO THE RIVER.
Exercises
Use Atbash on the Latin alphabet. (a) Encipher STONE. (b) Decipher XZVHZI. (c) Explain why enciphering and deciphering are the same operation in Atbash but not in a Caesar shift of three.
A scytale message was unwound from a rod that holds 3 letters per turn: SHNEEONLWDPX. (a) Decipher it by writing the letters in columns of three and reading across. (b) A rod that holds 4 letters per turn is used by mistake. Do you get sensible text? What does this say about the rod as a key?
This Caesar-type message uses an unknown shift: JHLZHY JPWOLY. (a) Break it by trying shifts one by one until you see English. (b) Which shift was used? (c) Why is this method of attack hopeless against a pairing cipher with a random key, even though both are substitution ciphers?
Quick Reference
- Transposition: same letters, new order (scytale)
- Substitution: same order, new letters (Caesar, Atbash, pairing)
- Caesar shift: move every letter a fixed number of places; only 25 keys
- Atbash: reverse the alphabet; no key at all
- Lesson: few possible keys means trying them all breaks the cipher
- Check: Plutarch's scytale account, the dates of the Kama Sutra passage, Chinese military code details
Next chapter: Arab Scholars and Frequency Analysis, where Al-Kindi shows that even a cipher with an enormous number of keys can fall to simple counting.