The release of the film, The Imitation Game, about the life and work of Alan Turing, inspired the Guardian to publish this description of how the German encryption device worked—and why, like all good cryptography, it was a simple concept that was a nightmare to break.
Part mechanical, part electrical, Enigma looked like an oversized typewriter. Input the first letter of your message on the keyboard, and then a letter lights up revealing what it has been replaced with in the encrypted message:
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.
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 code breaking 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, it was possible to eliminate thousands of potential rotor positions.