Skip to main contentSkip to navigationSkip to navigation
Enigma machine
Enigma machine. Photograph: Linda Nylind for the Guardian
Enigma machine. Photograph: Linda Nylind for the Guardian

How did the Enigma machine work?

This article is more than 9 years old
On the day The Imitation Game hits cinemas, a look at how Allied codebreakers untangled the Enigma

Like all the best cryptography, the Enigma machine is simple to describe, but infuriating to break.

Straddling the border between mechanical and electrical, Enigma looked from the outside like an oversize typewriter. Enter the first letter of your message on the keyboard and a letter lights up showing what it has replaced within the encrypted message. At the other end, the process is the same: type in the “ciphertext” and the letters which light are the decoded missive.

Inside the box, the system is built around three physical rotors. Each takes in a letter and outputs it as a different one. That letter passes through all three rotors, bounces off a “reflector” at the end, and passes back through all three rotors in the other direction.

The board lights up to show the encrypted output, and the first of the three rotors clicks round one position – changing the output even if the second letter input is the same as the first one.

When the first rotor has turned through all 26 positions, the second rotor clicks round, and when that’s made it round all the way, the third does the same, leading to more than 17,000 different combinations before the encryption process repeats itself. Adding to the scrambling was a plugboard, sitting between the main rotors and the input and output, which swapped pairs of letters. In the earliest machines, up to six pairs could be swapped in that way; later models pushed it to 10, and added a fourth rotor.

Despite the complexity, all the operators needed was information about the starting position, and order, of the three rotors, plus the positions of the plugs in the board. From there, decoding is as simple as typing the cyphertext back into the machine. Thanks to the reflector, decoding was the same as encoding the text, but in reverse.

But that reflector also led to the flaw in Enigma, and the basis on which all codebreaking efforts were founded: no letter would ever be encoded as itself. With that knowledge, as well as an educated guess at what might be encrypted in some of the messages (common phrases included “Keine besonderen Ereignisse”, or “nothing to report” and “An die Gruppe”, or “to the group”), it was possible to eliminate thousands of potential rotor positions.

Eventually, the team at Bletchley Park built a machine, the Bombe, which could handle that logical analysis. But the final steps were always performed manually: the job of the Bombe was merely to reduce the number of combinations that the cryptanalysts had to examine.

Even as the Allied code-breaking team were working on Enigma, the Axis was improving its machines, adding more and different rotors, and minimising operator error. Eventually, the Enigma was superseded by the Lorenz. These required yet more codebreaking in Britain, and more automation to do it – leading to the production of Colossus, the world’s first digital programmable computer.

More on this story

More on this story

  • The Imitation Game: inventing a new slander to insult Alan Turing

  • Alan Turing’s name restored with film about his work, life and identity

  • Alan Turing Institute for Data Science to be based at British Library

  • The Imitation Game: Alan Turing's outsider status fuelled his genius

  • The Imitation Game cracks UK box office, Interstellar keeps high orbit

  • Budget 2014: Alan Turing Institute to lead big data research

  • Engineers, linguists and other heroes

  • The Imitation Game review – Cumberbatch cracks biopic code

  • The Imitation Game: how Alan Turing played dumb to fool US intelligence

  • Hidden heroes of codebreaking history

Most viewed

Most viewed