Secret Writing
Three short lessons on codes and how they are broken: shifting the alphabet, counting letters to crack a shift, and why a longer key is harder to break.
Spark & Whetstone · sparkwhetstone.org/learn/secret-writing · CC BY-NC-SA 4.0. Answers are at the end, so you can try each question first.
Lesson 1. Shift the alphabet
The Roman writer Suetonius tells us that Julius Caesar wrote some letters in a simple code: each letter replaced by the one three places later in the alphabet. A became D, B became E, and so on, wrapping round at the end.
This is now called a Caesar cipher, or a shift cipher. To read it, shift each letter back by the same amount.
Question. With a shift of 3, what does the coded word "FDW" say?
- CAT
- DOG
- BAT
Say it back. In your own words: how does a shift cipher work?
________________________________________________
________________________________________________
Lesson 2. Count the letters
A shift cipher has only 25 possible shifts, so you could try them all. But there is a faster way, first written down by the Arab scholar al-Kindi in the 800s: frequency analysis.
In English text, E is the most common letter. Count the letters in a coded message; the most common one probably stands for E. Work out the shift from there.
Question. In a long coded message, the most common letter is H. What shift was probably used?
- A shift of 3
- A shift of 7
- A shift of 1
Say it back. Say it back: how does counting letters break a shift cipher?
________________________________________________
________________________________________________
Lesson 3. Longer keys
A shift cipher fails because every letter is moved the same way. In the 1500s, codes used a keyword instead: each letter of the message is shifted by a different amount, given by the next letter of the keyword.
Now E is not always coded as the same letter, so simple counting stops working. Modern codes take this idea much further, which is why a longer key is generally harder to break.
Question. Why is a keyword cipher harder to crack than a shift cipher?
- Each letter is shifted by a different amount, so letter counts are scrambled.
- It uses a different alphabet.
- It has no rules.
Say it back. In your own words: why does a longer key make a code stronger?
________________________________________________
________________________________________________
At the table: Make a cipher wheel
Players: a grown-up and a child, 7 or older. You'll need: two paper circles of different sizes, a pencil and a paper fastener (or pin).
- Write the alphabet round the edge of each circle and pin the small one on the large one.
- Turn the inner wheel three places. Write a short message in code.
- Swap messages and decode each other's.
- Try a mystery shift and crack it by counting letters.
Answers
- CAT — F → C, D → A, W → T: CAT.
- A shift of 3 — If H stands for E, the shift is E → F → G → H: three places.
- Each letter is shifted by a different amount, so letter counts are scrambled. — With different shifts for different letters, E no longer always becomes the same letter, so counting fails.