Chapter 04

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.

MachineUserNotes
EnigmaGermany (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 CommandA 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.
TypexUKAn Enigma derivative with extra protections. No evidence it was broken during the war.
SIGABA (ECM Mark II)USAFifteen 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:

  1. 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.
  2. Plugboard (Steckerbrett): cables swap pairs of letters. Ten cables were standard. This added by far the biggest share of the key space.
  3. Three rotors, right to left, each scrambling the letter.
  4. Reflector (Umkehrwalze): sends the current back by a different path.
  5. 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

Wehrmacht Enigma I

Signal path for the last key pressed

Press a key (or type on your keyboard while this panel is in view)

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:

ComponentChoices
Rotor order (3 from 5, in order)5 × 4 × 3 = 60
Starting positions26³ = 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

Why it fell: flaws you'll see again in modern crypto The maths was good. It was operational and design shortcuts that broke it, as with WEP, Heartbleed and many breaches since.
Visit You can see working Bombe and Colossus rebuilds at Bletchley Park and The National Museum of Computing in Milton Keynes.

Knowledge check