Wikijunior:World War II/Enigma

In World War I, the British managed to break the German codes. This let them listen in to important messages being sent from Germany to the soldiers. After the war, the British cryptanalysts (someone who breaks codes and ciphers) carried on listening to German messages. Then in 1926 they started to receive coded messages that they couldn't crack. This was because the Germans had started using a new machine for coding their messages called Enigma. The story of how Enigma was cracked is an exciting one. The men and women who solved the problem were war winners because the Germans never knew the British and their allies were reading every secret. The effort to crack Enigma led to the invention of modern electronic computers too.

What was Enigma?
Enigma was a machine for turning a "plain text" message into a "coded message", and turning it back into plain text again. The person using the machine typed a message onto a keyboard that looked just like the one on computers you use in school today. After the person typed the letter, Enigma passed the letter through rotors and a plug board which changed the letter into a different one that was then shown on the lamp board. The person wrote down the new letter - this was now in code. Then, as each letter was typed in, the rotors moved forward one click, changing the code that was being used. Once the whole message had been typed in and the coded message copied out, it would be sent out. This could be by telephone, radio or written down, it didn't matter.

You might think that if you had an Enigma machine you could just turn coded messages back into plain text messages, known as decoding. But it wasn't that easy. How Enigma changed a letter would be different based on how the rotors and plug board were set up. If you didn't know the original settings, you couldn't decode the message.

The Germans used to send out code books that had a day key for each day. This told people using Enigma how to set up their plug board and rotors. So, if you captured a code book and you had an Enigma machine, you could read messages. Because the Germans knew they might lose a code book (even though everyone had orders to burn them if they thought they would be caught), each book only had a month of codes in it. That way, at the worst, their messages could be read for one month. To make messages even tougher to read, the day key was only used to code the first three letters of the message. Then these first three letters were used as a new part of the code, called the message key, for just that message. That is, every message had its own special code!

The Poles break it by hand
The first people to try and crack Enigma were the Poles. The Germans had invaded Poland in World War I, and they were worried it would happen again. So they worked hard to break the code. At first they thought it was unbreakable, but then their chief code breaker, Marian Rejewski, had an idea.

The Germans were sending the message key twice to make sure it was read properly. Let's say the message key was "ABC", the Germans would enter "ABCABC" into the Enigma machine. Because the rotors move, this would be coded differently each time, maybe as "DGHYIU". It's pretty complicated to explain, but this difference in the coding lets the code breaker understand something about the way the Enigma has been set up. Rejewski found a way to work out how the Germans had set the rotors and plug board from a small number of coded messages. To turn this into a useful way of quickly breaking the code he had to write down the 105,456 different ways an Enigma could be set up. Bet you wouldn't like to have to do that for homework!

Bombes!
This wasn't the end of the problem for code breakers. Soon after Rejewski's success, the Germans changed the way they set up Enigma, meaning he would have to rewrite his whole book of settings. Instead of doing this he invented a machine that could automatically check the settings. He called it a bombe. Another feature of Enigma is that the rotors (there are three) can be swapped around. Because that means there are six different ways the rotors could be put into the machine sending the secret message, there have to be six bombes working away to check for the right settings to decode the message.

The bombes worked well until 1938, just before the beginning of World War II. Then the Germans gave all Enigma users two more rotors, so they now had a choice of five to put in the three slots. This meant that Rejewski would need 60 bombes. Not only that but the number of plug board cables went up from six to ten. Together, these meant that the Poles could no longer read the messages.

The British and French get involved
The Poles knew war was coming and that they didn't have the time or money to solve the new Enigma codes. So, the head of the Polish code breaking team went to meet his friends from Britain and France. He told them all about the code breaking efforts and gave them a bombe as well. Just three weeks later Germany attacked Poland and World War II began.

Bletchley Park
The British code breakers were based at a beautiful mansion house called Bletchley Park. This was to keep them away from other people who they might accidentally tell about their code breaking efforts. It was just as important to keep code breaking success quiet as it was to break the codes in the first place. If the Germans knew their code was broken, they'd just change it.

Alan Turing


The most famous person who worked at Bletchley Park was Alan Turing. His friends believed he was a genius. His first idea to help crack the new, stronger, Enigma was to look for patterns in German messages. He realised quickly that German submarines often sent a weather report in their messages. So, the code breakers would try and break the coded message by guessing that the first word was "wetter" (the German for "weather"). But this still meant they had to check billions of possible rotor and plug board settings.

Then Turing had his brainwave - the spark of genius that many think helped more than anything else to win the war. He worked out a way to wire up a machine so that the plug board made no difference. So instead of having to check 159,000,000,000,000,000,000 (that's a HUGE number) settings, he only had to check 17,576. And then he set up the machine so it lit up bulbs when it found a match. So, Turing's machine could break the code in about five hours - a fantastic achievement. But this still relied on having a clue to the code (like "wetter"). So the British set about ways of making sure messages sent by the Germans would have clues.

One way this was done was to drop sea mines. When they were found by the Germans, they would radio the location back to base. The British would read the message which was bound to contain the location of the mine. But the British already knew the location because they dropped the mine! This allowed them to use this location as a clue to break the code.

How did it help?
To give you an idea of how important the code breaking was, during the Battle of Britain the people at Bletchley Park were able to warn of bombing raids, how many airplanes the Germans had lost and so on. This let the RAF plan which German airplanes they should attack, and which they should ignore.

It let the Royal Navy find all the German submarines that were sinking ships in the Atlantic Ocean, and sink them quickly.

The British mined German rivers so they couldn't be used for shipping. Whenever the Germans reported that they'd cleared some mines, the British read the message and just dropped more mines!

Before D-Day, the allies knew where every major German army unit was based and how strong they were, letting them plan the attack in the safest way.

Winston Churchill, the British leader certainly knew how important the code breakers were. Once they wrote to him asking for more money and people to help their efforts. Churchill was very busy running the war but he found time to send this message the same day:


 * "ACTION THIS DAY
 * "Make sure they have all they want on extreme priority and report to me that this has been done".