The Enigma Machine

There is no way to summarize succinctly the incredible story of the Enigma Machine and the drama that surrounded the machine in this blog post, so I highly recommend reading some of the many wonderful books on the subject or reading the excellent chapter on the machine in Simon Singh’s book as I am.

With that said, I will try to give you an overview of how it is the Enigma Machine was developed and how it worked, as well as how it was finally cracked.

Arthur Scherbius, a German inventor and engineer developed the Enigma around the end of the first world war and tried at first (unsuccessfully) to sell it to commercial companies to help them protect their communications from competitors.

Arthur Scherbius' patent for the Enigma Machine
Arthur Scherbius' patent for the Enigma Machine

The device looked like a typewriter with a keyboard in the middle, a plug board below it and a set of lights that were associated with letters in the alphabet above the keyboard. The keyboard sent an electrical signal through a plug board which allowed the user to customize the wirings of letters, mapping the A key to the P key for example, the signal would then continue to a set of three scrambling cylinders that would take the signal and output it to another position. This process would be repeated two more times scrambling the signal through three levels of the rings and then into a reflector at the end which would then send the signal back up through another path on the scramblers. The signal would then finally terminate at the lights, illuminating the cipher text which corresponded with the original keypress.

What made the machine complicated was the fact that on top of the customizations available (the plug board settings, the scrambler settings and the scrambler order) the machine would then automatically rotate the scramblers with every key press creating a new scrambling order and developing a new cipher for every sequential key.

After many attempts to decipher the messages being enciphered by the Enigma most cryptanalysts simply gave up, believing the system was impregnable. At the same time many governments were shuttering their cryptanalysis bureaus because of the new sensibility that couldn’t permit the eavesdropping and spy craft necessary.

This was not the case in Poland, the young nation was terrified of its neighbors and when faced with the challenge of the Enigma Machine they adapted and persevered. The Polish Biuro Szyfrów began recruiting German-speaking mathematicians into their ranks to take a stab at deciphering the Enigma and when coupled with some excellent spy craft that gave them the scrambler wiring configurations a mathematician named Marian Rejewski was able to deduce a weakness in their system.

To understand the weakness you have to understand the process used to encrypt and send messages. The Germans utilized a set of code books that were developed and distributed every month to all of the hundreds of Enigma operators. The code books detailed day codes to be used by all operators that set the plug board order, the scrambler order and the scrambler settings. This was the greatest weakness they realized. If the code books fell into enemy hands it could be conceivable that the enemy could simply plug-in the settings and intercept all of the orders being broadcasted by all the Enigma operators.

To combat this the Germans instituted a message key system that the message senders used to make unique encryptions for each message. After setting the Enigma to the day code, the operators were instructed to pick a random three-letter combination for a new message key and transmit that twice in the day code setting, and then reset their machines to the new message key settings and finally transmit the entire message. The weakness was the repetition. As you remember, repetition is the enemy of security, and when Rejewski realized this fatal error he exploited it ruthlessly.

Through tedious experimentation he was able to deduce that in order for a message key such as ABR, when repeated ABRABR, and enciphered TWEVZP, to become this unintelligible mess the rotors of the scramblers had to have turns 6 times. Since the first and fourth letters, as well as the second and fifth letter and the third and sixth letters were identical, the process of scrambling had in fact been revealed. If you could track how the scrambler had to have turned in order for the letter to be enciphered one way initially and another way in just three steps then you can deduce how the scramblers were set up.

With this information Rejewski and the team at Biuro Szyfrów were able to monitor almost all German communications even as their allies were blind. Unfortunately, this wasn’t able to save Poland, as just before the war broke out Germany added several layers of complexity to the Enigma machine by adding additional scrambler configurations and extra plug board inputs. The Polish then decided to share what they knew with other allied forces just two weeks before Germany invaded Poland.

Utilizing what Rejewski and the Biuro had managed to do, the teams of cryptanalysts in Britain’s Bletchley Park were able to decipher the now more complex Enigma messages up until the German’s stopped broadcasting the repeated message keys. At this point however, a brilliant mathematician named Alan Turing had begun work on a slightly varied way of exploiting the numerical structure of the Enigma cipher.

Turing is widely acknowledged to have developed a formal framework for the modern computer as a young academic before taking up his secretive role at Bletchley Park. Utilizing this system of computing, Turing thought of a way of mechanizing the process of deciphering the day codes through exploiting yet another human error: the error of being predictable. The cryptanalysts realized at some point that the German operators often wrote messages the same way again and again. For example the weather reports would often start one way. If you could reasonable assume that a message included a specific text (this was called a crib), then you can play with this piece of cipher text and run through the various permutations of scramblers until the code was revealed.

Turing built this machine and after a few iterations had a series of these machines to descramble the day codes in hours if the cribs were accurate. This wouldn’t always work, but it worked well enough to provide a huge advantage to the Allied forces as they intercepted German assault boats and convoys as well as troops and reinforcements. The German’s never suspected their Enigma had been cracked.

Author: Ali

Developer and dreamer. I like to solve problems and make things come to life.

Leave a Reply

Your email address will not be published. Required fields are marked *