Rotors and Enigma

Secret Writing: A History of Codes, Ciphers and Codebreaking

Course 1 · Chapter 8 · Rotors and Enigma

Chapter 7 ended with a hard lesson: reuse is fatal, and hand ciphers cannot keep up with millions of words. The answer of the 1920s was to build the cipher into a machine, one that changes its alphabet at every key press. This chapter explains in plain terms how that worked, why Enigma was both clever and flawed, and how Polish mathematicians broke it before the war began.

From Shift to Machine

Chapter 5 showed that using many alphabets beats using one. The weakness of Vigenere was that its key repeated, and the repeat gave Kasiski a way in. A machine could change alphabet at every letter and take an enormously long time to repeat. In the years after the First World War, several inventors in different countries patented such machines. The idea they shared was the rotor: a wheel with a scrambled wiring that turns a little after each letter.

Key ideas and dates Rotor: a disc with 26 contacts on each face, wired inside to scramble the alphabet.
Enigma (1920s onward): a rotor machine sold commercially, then adopted in modified form by German forces.
Plugboard: a panel of cables that swaps pairs of letters before and after the rotors.
Marian Rejewski (early 1930s): Polish mathematician who worked out the wiring and a way to find daily settings.
1939: Polish cryptologists share their methods with the French and British.
Not Yet Verified The dates and names above are written from general knowledge and were not checked against a source for this chapter. Treat them as pointers for your own search.

How One Rotor Works

Think of a rotor as a fixed scramble that moves. Press a key and current flows through the rotor's wiring, leaving at a different letter. Then the rotor turns one place, so the next press uses a slightly different scramble. Even if you press the same letter twice, the cipher letters differ.

A rotor reduced to its simplest idea: a shift that grows with each letter Plain : E N I G M A Shift : 1 2 3 4 5 6 Cipher : F P L K R G A real rotor scrambles with a wiring pattern, not a plain shift, but it steps forward in just this way after every key press.

Three Rotors and a Plugboard

A single rotor repeats after 26 letters. Enigma chained several: in the common army and air force version, three rotors in a row, each stepping the next one like the wheels of an odometer. The fast rotor turns at every key press, the middle one turns once per 26 presses of the fast one, and the slow one once per 676. The whole arrangement takes 17,576 letters to return to where it began.

A reflector at the end sent the current back through the rotors by a different path. That made the machine reciprocal: with the same settings, typing the cipher text produced the plain text. It also created Enigma's most important flaw, described below. On top of this, the plugboard swapped several pairs of letters before and after the rotors, multiplying the number of possible settings enormously.

The path of one letter through the machine, in outline keyboard -> plugboard -> fast rotor -> middle rotor -> slow rotor -> reflector -> slow rotor -> middle rotor -> fast rotor -> plugboard -> lamp lights Before each letter, the rotors step like an odometer.

The Flaws

Enigma had a huge number of settings, and German users believed it unbreakable. Its weaknesses came from design choices and from habit.

  • No letter encrypts to itself. The reflector made this impossible. That sounds harmless, but it lets a codebreaker rule out many guesses about a message.
  • Predictable messages. Weather reports, greetings and fixed endings gave likely words, called cribs.
  • Operator habits. Lazy choices of starting positions, such as repeating three identical letters, gave patterns away.
  • Procedure. In the early 1930s each message began with a key that was sent twice, and that repeat leaked information.
Not Yet Verified The details of the message-key procedure, the number of plugboard cables in use and the way procedures changed over the years are written from general knowledge and were not checked here. Search for sourced accounts before relying on them.

The Polish Breakthrough

In the early 1930s a small team in the Polish Cipher Bureau, led in the key work by the mathematician Marian Rejewski, attacked the German machine. They used mathematics about the way letters are permuted, together with some documents obtained through intelligence, to reconstruct the internal wiring of the rotors. They then found how to recover the daily settings from the repeated message key. They built machines of their own to speed the search.

When Germany changed its procedures and added rotors and plugboard cables, the Poles' methods grew harder to apply. In July 1939, weeks before the war, they shared what they knew, and replicas, with French and British intelligence. The work was the foundation on which Bletchley Park built, which is the next chapter.

Not Yet Verified Names, roles, the source of the intelligence documents, and the date and place of the 1939 meeting are written from general knowledge and were not checked. The Polish contribution is widely accepted, but the details vary between accounts.

Comparing the Machines

SystemAlphabets in useStrengthWeakness
Caesar shiftOneEasy by handOnly 25 keys
VigenereAs many as the key lettersHides single-letter frequenciesKey repeats (Chapter 5)
Codebook (Chapter 7)Fixed meaningsCheap, quickReuse reveals the book
EnigmaA new one at every letterHuge number of settingsNever maps a letter to itself; habits and procedure

What Rotors Teach

First, automation helps the sender and the enemy: a machine can encipher faster than any clerk, but it can also be copied and studied. Second, size is not security: a vast number of settings meant little once the flaws narrowed the search. Third, people are part of the system: operator habits did as much damage as any design fault.

Try it yourself: a stepping shift This message was enciphered with a stepping shift, like a one-rotor machine. The first letter was shifted forward 1 place, the second 2 places, the third 3, and so on. To decipher, move each letter back by the same amount:

NGHXFZKIFX

What does it say?
Show the worked answer

N back 1 is M, G back 2 is E, H back 3 is E, X back 4 is T, F back 5 is A, Z back 6 is T, K back 7 is D, I back 8 is A, F back 9 is W and X back 10 is N. The message is MEET AT DAWN. Notice that the two Ts in the plain text became X and Z: the repeat has vanished, which is exactly what defeated simple frequency counting.

Where This Leaves the Secret Writer

By 1939 Germany trusted a machine that Poland had already cracked, and the Allies had inherited the means to read it, if they could keep up with the daily changes. The next chapter moves to Bletchley Park, where that race was run on a vast scale.

Exercises

Exercise 1

A plugboard swaps these pairs: A and Z, T and Q, C and K, D and M. Letters not listed stay the same. Decode the message ZQQZKC ZQ MZWN. Then explain why the same table also works for enciphering.

Exercise 2

Decipher IQOHYNLXJCD, enciphered with a stepping shift where the first letter is shifted 1 place, the second 2 and so on. Then say what is different about the two S letters in the plain text compared with an ordinary Caesar shift.

Exercise 3

(a) With three rotors of 26 positions each, how many starting positions are there? (b) Three different rotors can be placed in the machine in any order. How many combinations of order and starting position is that? (c) Enigma never enciphers a letter as itself. How would that help a codebreaker who guesses a word in the message?

Quick Reference

  • Rotor: a wired disc that scrambles letters and steps after each key press
  • Enigma: three rotors, a reflector and a plugboard; 17,576 rotor positions
  • Reflector: makes the machine reciprocal, but means no letter becomes itself
  • Crib: a guessed piece of plain text used to attack a message
  • Polish breakthrough: wiring and daily settings recovered in the early 1930s
  • Check: dates, names and procedure details

Next chapter: Bletchley Park, with Turing, the bombe, Lorenz and Colossus, ULTRA, and Navajo code talkers.