Not just a shift — a whole scramble
The Caesar cipher has one weakness: the shift is uniform. E always goes to the same letter, T goes 3 ahead of E, etc. So the shape of the frequencies stays the same.
A substitution cipher is stronger: every letter is assigned to a different letter completely at random.
| Plain | A | B | C | D | E | F | G | H | I | J | K | L | M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Cipher | Q | W | E | R | T | Y | U | I | O | P | A | S | D |
Now E might go to T, T might go to H, A might go to Q — all unrelated. There are 403,291,461,126,605,635,584,000,000 possible keys (that’s 26 factorial). You cannot try them all. Ever. In the lifetime of the universe.
So is it unbreakable?
No. Frequency analysis still wins.
How to crack one
Here’s the recipe:
- Count letters. The most common letter is probably E.
- Look at 3-letter words. A common one is probably THE — that gives you T, H, E all at once.
- Look at single-letter words. Those are A or I.
- Look at doubled letters (like XX). Common doubles are LL, EE, OO, SS.
- Fill in guesses and look for partial words. If you see
TH_Sa lot, the blank is probably I (THIS). - Iterate. Correct mistakes as better guesses appear.
Crack this one
Below is a real substitution cipher. You have an interactive tool: click a cipher letter and type what you think the real letter is.
The quote is from a famous scientist, about curiosity and learning.
Try another one
When substitution cipher DOES work
Substitution ciphers were good enough for:
- Short messages (not enough letters for frequency analysis to settle)
- People who didn’t know frequency analysis existed (pre-900 AD!)
- Spies sending a single coded word as a signal
They were broken around 800 AD by an Arab mathematician named al-Kindi who invented frequency analysis. Most cryptographers still didn’t catch on for another 700 years. That’s how powerful a simple new idea can be.
Practice
How many possible keys does a general substitution cipher have?
26! ≈ 4 × 10²⁶. Far too many to try all of them. And yet, frequency analysis still beats it.
If a single letter appears by itself as a word in a ciphertext, it's probably...
In English, the only single-letter words are A and I. Huge clue.
Who invented frequency analysis?
al-Kindi, an Arab mathematician in Baghdad. His manuscript 'On Deciphering Cryptographic Messages' was rediscovered in 1987. The idea was 1200 years ahead of most of Europe.