Enigma & the machine age
In the early 20th century, rotor machines automated polyalphabetic substitution. The key changed with every keypress, giving a sequence of alphabets so long it looked unbreakable. Enigma is the most famous example, and so is the story of how it was broken.
Electromechanical cipher machines
A rotor is a wheel with 26 contacts on each side, wired in a scrambled pattern, so each rotor is a substitution cipher. Stack several, make them turn like an odometer after each letter, and you get a polyalphabetic cipher whose key repeats only after thousands of letters, rather than every five as a keyword like LEMON does.
| Machine | User | Notes |
|---|---|---|
| Enigma | Germany (1920s–1945) | Patented by Arthur Scherbius in 1918 and sold commercially before military adoption. Broken by Polish and then British codebreakers. |
| Lorenz SZ40/42 ("Tunny") | German High Command | A 12-wheel teleprinter stream cipher that XORed a keystream with the message. Broken through Bill Tutte's analysis. Tommy Flowers built Colossus, the first programmable electronic digital computer, to speed up the attack. |
| Typex | UK | An Enigma derivative with extra protections. No evidence it was broken during the war. |
| SIGABA (ECM Mark II) | USA | Fifteen rotors with irregular stepping. Never known to have been broken. |
| Purple (Type 97) | Japan (diplomatic) | Used telephone stepping switches instead of rotors. US Army SIS cryptanalysts reconstructed it in 1940 without ever seeing a machine. |
How Enigma works
Press a key and an electrical current makes a round trip through the machine, then lights a bulb on the lampboard:
- Stepping: before the current flows, the right-hand rotor turns one place. When it passes its notch, it also kicks the middle rotor on, and the middle rotor does the same to the left one.
- Plugboard (Steckerbrett): cables swap pairs of letters. Ten cables were standard. This added by far the biggest share of the key space.
- Three rotors, right to left, each scrambling the letter.
- Reflector (Umkehrwalze): sends the current back by a different path.
- Back through the rotors left to right, back through the plugboard, and a lamp lights.
The reflector makes Enigma reciprocal: if A encrypts to K at a given setting, K encrypts to A. That was convenient, because the same settings decrypt, but it introduced a fatal flaw: a letter can never encrypt to itself.
Enigma I simulator
Signal path for the last key pressed
Input
Output (grouped in fives, as operators did)
Try this: note the rotor start positions, type a message, then press Reset and type the ciphertext. The plaintext comes back. Also notice that no letter ever lights its own lamp.
How big was the key space?
With the standard Army setup (choose 3 rotors from 5, set their starting positions, and use 10 plugboard cables) the daily key was one of roughly 159 million million million combinations:
| Component | Choices |
|---|---|
| Rotor order (3 from 5, in order) | 5 × 4 × 3 = 60 |
| Starting positions | 26³ = 17,576 |
| Plugboard (10 pairs) | 150,738,274,937,250 |
| Total | ≈ 1.59 × 10²⁰ (about 67 bits) |
That's a huge number for the 1940s. Ring settings add some more, and the Navy's four-rotor M4 added a lot more. But the size of a key space doesn't help much when the design leaks structure, and procedures make it worse.
How Enigma was broken
- 1932
Polish mathematician Marian Rejewski used permutation theory, together with documents bought by French intelligence from the spy Hans-Thilo Schmidt, to work out the military Enigma's rotor wiring. With Jerzy Różycki and Henryk Zygalski he went on to build the cyclometer, Zygalski sheets and the bomba. - July 1939
Weeks before the invasion of Poland, the Polish Cipher Bureau gave its replica Enigmas and methods to British and French intelligence. - 1939–1940
At Bletchley Park, Alan Turing and Gordon Welchman designed the British Bombe. It tested rotor settings against a crib, a guessed piece of plaintext such asWETTERBERICHT(weather report) orKEINEBESONDERENEREIGNISSE("nothing special to report"). - 1941–1945
Captured material (U-110, U-559) and huge Bombe production let the Allies read much Enigma traffic. The intelligence, codenamed Ultra, is widely credited with shortening the war.
- Design flaw: no letter encrypts to itself. Codebreakers slid a crib along the ciphertext and ruled out any position where a letter matched itself.
- Known plaintext: formulaic messages gave reliable cribs.
- Key management failures: early procedures sent the message key twice at the start of each message, and operators chose lazy keys like
AAAor their girlfriend's initials ("cillies"). - Compromised material: captured codebooks and machines.