The Cryptanalysis of Enigma

Matthew Abel – Year 10 Student

Matthew Abel (Year 10) writes on the theme of ‘Security’, in response to the recent One Word essay writing competition advertised in The GSAL Journal. Matthew’s chosen topic is the cryptanalysis of the famous Enigma ciphering machine that proved to be so critical in the outcome of World War II. CPD


The year is 1939 and the world is in crisis. Everyone is at war. Hitler is plowing through Europe and nobody is stopping him. People are scared for their lives because this political tyrant seems to oversee everyone’s life. They estimate Hitler will win the war in under a year. His army is ruthless, and his security is flawless. What is Britain doing to stop him? The Germans think they will win the war because they have the first ‘unbreakable’ code. What do the Allies have? We don’t have the weapons or the brutality that the Germans have, and we certainly don’t have an unbreakable code. But we have brains, and in the end, that’s what matters most.

Following World War I Germany was furious. They had lost the war and their codes had been broken with ease.  Luckily for them, German engineer Arthur Scherbius had created one of the first cipher machines. He called it Enigma, after the Latin word for puzzle. It wasn’t long before the army were buying thousands. Not only were Enigma machines portable, but they were also considered ‘unbreakable’!

Before the war all codes were made and cracked with pen and paper, like the Caesar shift, a substitution cipher. If a shift of three letters was used, then hello would become ‘khoor’. As you can see, the double L stays as a double letter, shifting to double O. However, with Enigma, hello might become ‘dpoxd’. Not only is the double L no longer a double, but the first and last letter are apparently the same, which they are not. Polyalphabetic ciphers are breakable, so why was Enigma considered unbreakable? If you wanted to encrypt: ‘Move army one-kilometre forward’ with a Vigenère cipher five times with the same key, you would get the same ciphertext five times, whereas if you encrypted the same message with an Enigma machine, you would get a different message every time you did it.

An Enigma machine. (University of Manchester/Flickr – labelled for reuse)

The Enigma machine looks very similar to a type writer. It has a keyboard in the centre where you type your plaintext, and a lampboard above it where the ciphertext appears. German operators in WWII would simply write down their cipher text and transmit them via radio in Morse Code. Somebody with an Enigma machine on the same settings could simply type the ciphertext into the keyboard and the plaintext would appear on the lampboard.

If you type A on your keyboard, this sends an electrical signal down the wires of ‘A’, which triggers the first variable. The plugboard connected ten letters to ten different letters. The others sixteen letters were simply connected to themselves. This significantly varied how the message would be encrypted. The Germans called it, the Steckerbrett. So, if ‘A’ was connected to ‘P’, then the electrons would travel down to ‘P’. Next, the electrons would meet the rotors, or scramblers. There are three rotors, each one having wires that connect letters to other letters.

We pressed A, it went through plugboard and came out as P. It then went through the first rotor which changed it to Q, the second to Z, the third to H, then it hit the reflector and came back the rotors, obviously in a completely different order, H going to R, R to B and B to D. So, D would come out of the first rotor and the final stop is to the lampboard where it would illuminate the D lamp. Then the first rotor would shift by one and if we were to press A again on the keyboard because it would go through a different wire on the first rotor, it would go through different wires on the second and third and then illuminate a different lamp, for example Y.

The inner workings of Enigma: in this example, inputting the letter ‘A’ generates an encoded output of ‘D’ – pressing ‘A’ again would produce a different encoded output. (Expert Programming Tutor – labelled for reuse)

Inside each rotor, all the wires are connected to the letter it correlates to in each cipher alphabet. When a key is pressed on the keyboard, the rotors have been designed so that the first one moves by one space, and therefore the cipher alphabet inside the first one is shifted by one space. When the rotor makes twenty-six shifts, the second rotor is shifted by one and when that makes twenty-six shifts the third rotor is shifted by one.

Clearly, it is a complex machine, however if, during the war, the allies could steal an Enigma machine, they could break all the codes the Germans sent. After all they were very portable! Scherbius thought of this and made sure there were variables. Therefore, he made five rotors for each machine and he made the plugboard that could change letters around. Every month, users of the Enigma machine were sent the monthly settings of the Enigma. This includes three things. Which of the three rotors to use, considering they were all different, what the starting positions of the rotors were, and which 10 letters were going to be connected on the plugboard. They were all totally random and changed every day. So, if you were to steal a machine and then managed to steal the monthly code books, you could crack Enigma for a month, then you were out. The monthly settings books were hard to steal. They were written in soluble ink, therefore if you sunk a German ship, for example, you couldn’t recover the settings. With all these factors counted in, the number of possible settings of the Enigma machine is: 158, 962, 555, 217, 826, 360, 000. Or a mere 159 million, million! If a British cryptanalyst tried each setting per minute, it would take them more than the age of the universe. Therefore, surely it is an unbreakable code!

Sometimes it’s the people no-one imagines anything of who do the things that no-one can imagine.

Alan Turing

It should have been but for a few mistakes. The Poles were the first to try and break Enigma but had very little success, even when a German traitor showed them pictures of the architecture of the machine. So it came down to the British. After the Poles realised that Enigma was almost unbreakable, they shared all they knew with their allies, the British. The British government were confident after WWI that they were the best cryptanalysts (codebreakers) in the world. Well, maybe they were but the Germans were the best cryptographers (codemakers) in the world.

The British government hired a mansion in Milton Keynes called Bletchley Park, it was the home of the Government Code and Cipher School or GC&CS. They hired people they thought would be best at codebreaking. Chess champions like Hugh Alexander, mathematicians like Alan Turing, and they even placed puzzles in the paper to recruit the right-minded talent. However, after months of staring at Enigma codes, the GC&CS made very little progress, considering common ways of code breaking includes Letter Frequency Analysis which is useless with Enigma.

Then a breakthrough came with a little bit of luck, and pure genius from Alan Turing. A letter came through from the Germans and a member of the GC&CS noticed something strange about it. It contained every letter apart from L. After studying the Enigma machine, Turing deduced that a letter can be encrypted as any letter apart from itself and the letter that Bletchley Park had received was simply L repeated about sixty times. This was a major breakthrough and it wasn’t long before Alan Turing and Gordon Welchman had created a machine that could search through all possible settings, whilst eliminating contradictions, like the fact that a letter cannot be encrypted as itself, as well as searching for common German words. For example, the cryptanalysts knew that the Germans sent out a daily weather report at six in the morning and would often finish their messages with Heil Hitler. The Bombe (as it was called) stepped through the settings, searching for Heil Hitler or Wetterbericht (German for Weather Report.) Also, after major events like D-Day, key words could also be programmed into the machine. Finally, after years of effort, it worked. The British had broken the Enigma machine.

However, there was a bigger problem. If the British just counteracted every move the Germans made, the Germans would realise that the allies had broken the Enigma Code and very quickly they would redesign Enigma and the GC&CS would have been back to square one.

Therefore, Bletchley Park had to use statistics and literally play God. If the number of victories they had was below 50% they believed the Germans wouldn’t suspect anything. In fact, Bletchley Park commanders allowed a ship to be destroyed that contained the brother of a cryptanalyst at Bletchley Park so that the Germans wouldn’t suspect the British had broken the code. The intelligence delivered by breaking the Enigma code made a considerable impact to the war effort and the true value will never be fully understood.

The British cryptanalysts shortened the war by an estimated two years, saving approximately 20-30 million lives.  ‘Sometimes it’s the people no-one imagines anything of who do the things that no-one can imagine.’ Alan Turing, the head of Enigma cryptanalysis, definitely lived up to his quote. Matthew 297809


References are not currently available for this article.

2 thoughts on “The Cryptanalysis of Enigma

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s