During World War II, the Germans were using an encryption code called Enigma – which was basically an encryption machine that encrypted messages for transmission. Today, encrypted chat apps and even some of the best VPN services do the same thing, although the encryption is impossible to break.
Most communications were sent via radio, which means that allied forces could listen in on their communications – hence the need for encryption. The German’s encryption scheme, however, was much stronger than older methods.
The Enigma code went many years unbroken – until the code-breakers at London’s Bletchley Park (including the famous Alan Turing) discovered a fatal flaw in the Enigma system, and eventually aided in the victory over the Nazi’s.
This is what a standard military Enigma machine looked like. It consists of a keyboard, a set of lights for each letter of the alphabet, three rotors (though some machines had 4 or 5), and a plugboard at the bottom.
To encrypt your message with an Enigma machine, you would simply type a letter and write down which the corresponding letter lit up on the alphabet. For each keypress, the rotors would move and the message was treated as one, so you had to send the full beginning-to-end message to your recipient.
The encryption system attempted to get around frequency analysis by first scrambling the letters with the plugboard (pictured frontmost) – which switched pairs of letters around adding a significant amount of complexity and then encrypting the message with the rotors, which moved for each character in the message. This means that you could type the same letter continuously, but Enigma would output a bunch of different individual letters.
To decode your message, you would need to know what rotor and plugboard settings were used to encrypt the message. The Germans accomplished this with monthly sheets – different codes for each day and they’d get a new sheet every month. This was the most significant problem for the allies – they had got their hands on quite a few Enigma machines, but getting the code sheets was difficult, and if they did they would only be good for the rest of the month. The allies focused instead of trying to crack the cipher, to eventually understand all of the German’s communications – without them knowing.
So, how mathematically secure is Enigma? It’s actually quite impressive. First off, there are three rotors used from the box of 5 rotors that the Enigma machine had. Picking those three from the 5 already has a lot of possible results:
From there, each rotor had a starting position. Each rotor had 26 positions (one for each letter of the alphabet.
Whew. That’s not even the big part yet. The plug board – which maps pairs of letters with each other before they are encrypted by the rotors, adds a significant amount of complexity.
Well then. The total possible configurations of an Enigma machine? Multiply them all together.
So how did the cryptographers at Bletchley Park crack the code? Luckily, they discovered a fatal flaw in Enigma.