Step 0 · The old waySwapping letters
The simplest secret code is over 2,000 years old: swap every letter for another one, always the same way. Julius Caesar used it — he just shifted the alphabet a few places. Shift by 3 and A becomes D, B becomes E, and HELLO becomes KHOOR.
→
Here's the problem: this code is easy to smash. In English, the letter E shows up more than any other. So a spy just counts which symbol appears most in your secret message — that's probably E. Then the next most common — probably T. Like a jigsaw, the whole thing falls apart in minutes. Codebreakers call this frequency analysis, and it kills every "always the same swap" code.
Trick 1 · The rotorA code that changes every letter
Enigma's first trick destroys frequency counting. Inside the machine sits a rotor: a wheel with 26 electrical contacts on each side and a secret tangle of wires between them. Electricity goes in at one letter and comes out at a different one. So far, that's just a fancy swap.
The genius part: every time you press a key, the rotor turns one notch before the current flows. The whole scrambling pattern shifts. Press A and you might get B. Press A again — the wheel has turned — now you get D. Again: Z. The "same swap" never happens twice in a row, so counting letters tells a spy nothing.
Press A over and over. Watch the rotor windows turn — and watch the answer change every single time.
Trick 2 · Three rotorsThe odometer
One turning rotor repeats its pattern after 26 letters. Not good enough. So Enigma stacks three rotors side by side, working like a car's odometer (the little wheel counter for kilometres): the right rotor turns on every keypress; when it finishes a full lap, it nudges the middle rotor one notch; when the middle one finishes its lap, it nudges the left one.
That's 26 × 26 × 26 = 17,576 different scrambling patterns before the machine repeats itself — far longer than any message. And the operator can also choose which three rotors to use out of five, and in what order, and how each one's inner ring is rotated. The numbers start exploding.
One rotor = a code wheel that keeps turning. Three rotors = a combination lock the size of a galaxy. You saw the three windows turning in the demo above — that's the odometer in action.
Trick 3 · The reflectorThe mirror that makes it magic
At the far left of the rotors sits the reflector — a half-wheel that catches the electric current and bounces it back through all three rotors again by a different path. So each keypress actually scrambles the letter seven times: three rotors in, the reflector, three rotors back out.
The reflector is what makes Enigma so easy to use. Because the current goes out and back through the same wheels, the machine is perfectly reversible: if pressing H lights Q today at this position, then pressing Q lights H. Encrypting and decrypting are the same action. No separate "decoder" needed — just an identical machine with identical settings.
Type a short word. Machine 1 scrambles it. Then an identical Machine 2 takes the gibberish and — same settings, same keys — unscrambles it.
Trick 4 · The plugboardThe final tangle
The German military added one more layer on the front of the machine: the plugboard. It looks like an old telephone switchboard — sockets for all 26 letters, and up to about ten cables. Plug a cable between A and M, and those two letters swap places before and after the rotors do their work.
It sounds simple, but it's the plugboard that pumps the number of possible setups to that famous 158 million million million. Most of Enigma's strength lives in those little cables.
The flawThe letter that could never be itself
Now the twist in the tale. The reflector always bounces the current back on a different wire than it came in on. Follow the consequence: the current can never travel back out to the very key you're holding down. In other words —
Pick a letter and press it 60 times. Every letter that lights up gets marked below. One letter will never light up…
Why did this matter so much? Suppose codebreakers guess a message contains the word WETTERBERICHT (weather report). They slide that guess along the gibberish, position by position. Anywhere a guessed letter would line up with an identical letter in the gibberish is impossible — Enigma can't do that — so it's crossed out instantly. The few positions that survive get fed to the Bombe machine. One tiny engineering shortcut, and it became the crack that the whole codebreaking effort was levered through.
Enigma's designers made it never do something (encrypt a letter to itself) because that seemed extra-safe. But "never" is information too! A perfect scrambler should sometimes leave a letter unchanged, just by chance. Being too tidy gave the game away.