The Enigma Machine
In my last post, we looked at how we can use one time pads to encrypt messages. However, the difficulty in using a one time pad is that while they have the potential to have the maximum amount of entropy (randomness) if done correctly and used only once, they are very difficult to work with in practice and it's very hard to transmit the cipher text (encrypted message) and then decode.
It is this difficulty in making and using one time pads, that lead us to exploring more mechanical options. One of the most popular mechanical cryptography devices is the enigma machine (dun dun duuuuuuuun). Not really that scary though. Compared to a one time pad, an enigma machine is WEAAAAK.
Buuut that doesn't mean that cracking it was an easy feat. The Allied Forces managed to do so by exploiting flaws in its design and mistakes in its operation. In order to see the flaws ourselves, we have to understand a bit about how the ole' thing works. A WW2 enigma machine was a mechanical typewriter with a set of lamps for outputs. It had three rotors.
They were each labeled with the letters of the alphabet, so that each rotor could have 26 possible settings. They each had a set of 26 contacts that connects with one another. The position of the rotor represented one of 26 potential mappings. With the three rotors working together. Each mapping is applied in order.
The rotors were arranged on a mechanical axis that advanced their position with every key stroke.
Where it starts getting tricky is that the central rotor would advance twice in position when all side rotors advanced once. This was considered to be an extra security measure insuring that no two rotors would have the same letters relative to one another for two consecutive characters. Then one additional security feature was added. A plug board!
A plug board was added to the machine. The electrical signals generated by the keys entered the cables in the plug board before getting to the first rotor. The plug board was extra security because each cable switched up two letters. By doing this, the operator could create a fourth mapping in addition to the three mappings created by the three rotors. Six patch cables could yield over one hundred BILLION combinations.
So how would you decrypt this things?!
As with one time pads, we just go backwards. You run the electrical current "backwards" through the rotors.
I know what you're thinking. How would someone intercepting a cipher text (encrypted message) made by one of these things crack the code. Well there is a few flaws in this design and as with one time pads, it's all about the patterns.