Friday, May 30, 2014

Cracking the Enigma Machine

Enigma Machine
Very Rare WWII Enigma Cipher Machine. This highly important three-rotor Enigma deciphering machine was used by the Nazis during World War II. Examples of Enigma machines are exceptionally rare and almost all known models are in museums.

People familiar with the Enigma Cipher Machine generally associate it with World War II, but it actually was a product of German engineer Arthur Scherbius at the end of World War I. Scherbius marketed the machines throughout Europe, and they were advertised extensively to companies to keep their ciphers confidential. The German military bought some. The common belief is that brilliant British scientists magically broke the code and thus won the war, but that also is erroneous at least in part.

Italian cryptographers
Italian Naval crypto officers operating an Enigma machine, not knowing that the cipher was being read by the Allies

Use of the Enigma machine was not a Nazi idea. The German military adopted the machine well before the Nazis took power in 1933. In fact, the Poles, Germany's natural enemy during the inter-war period, went to work on it at once and first broke the German military code in 1932.

Three Polish cryptologists, Marian Rejewski, Jerzy Różycki and Henryk Zygalski, were mainly responsible. They continued reading the codes through the 1930s, but towards the end of the decade the Germans starting embellishing the machine and adding new twists and turns to the code that made things harder for them.

On 15 September, 1938, the Germans changed their use of the Enigma cipher, implementing a new key scheme as war drew nearer. The new code appeared vastly more complicated, so the Polish cryptologists invented the first mechanical pseudo-computers to help them in their work. In October 1938, Rejewski designed a machine named "bomba kryptologiczna" (a cryptologic bomb, as computers were known in those days), which was soon produced at the Polish AVA Workshops. They also developed a "cyclometer" machine to assess the pattern of the key.

Enigma Machine
Close-up of a later Enigma machine. Note the fourth "shark key" rotor

While they were keeping up with the Germans (barely), the Poles decided to spread the love and spilled the beans to the British about their efforts in July 1939. They hoped to get more manpower on the decryptions so that they could be sure of knowing in advance if the Germans were going to attack. It was a dangerous summer, with the Germans mounting false-flag "provocations" supposedly by the Poles against Germany, and everybody was on edge. On 16 August 1939, the Poles gave British General Stewart Menzies a working copy of the Enigma Machine at the Victoria Station in London in a James Bond-style hand-off. The timing was fortuitous for the Allies, as the Polish state ceased to exist only two months later due to the German invasion.

The Polish cryptographers had to leave Poland in a hurry that fall, and after a quick stop in Romania they wound up in France. There, they worked with French and Spanish cryptographers under code-name "Bruno." They also continued to keep the British up to speed on their cryptological discoveries. After Germany invaded France in May 1940, the Poles again evacuated. This time they went to Algeria, using a French military plane on June 24, 1940 in one of the French government's final acts before their Armistice with Germany. After working in Algeria for a while, the Poles returned to France and worked right under the Germans' noses in Free France.

In the beginning of October 1940, the Poles set up shop in Fouzes, France under code-name "Cadix." They worked there with French and Spanish cryptographers. The "Bruno" centre successor decrypted the following types of German messages:
- German military orders to the units in Europe and in Libya,
- SS and Police (Polizei) messages from Europe,
- Spy radio communications between the field agents in Europe or in Libya and Abwehr HQ in Stuttgart,
- Diplomatic communications and German Armistice Commission communications
- Communications by 
Wehrkreis XII (controlled parts of occupied France and western Germany) in Wiesbaden and their branches in France and in North Africa.
For those who claim that breaking the Enigma Code was all things to all people, note that although the Poles broke the code first, there is absolutely no indication that they were able to use that information to any great advantage. In fact, the results of breaking the German code appear to have been fairly valueless to Poland. Knowing what the enemy is saying only helps if you know how to use the information to your advantage, get the right information from the enemy to help yourself, and have the resources to make good use of it. For all the brilliance displayed in cracking the code, none of that appeared to apply to Poland and its cryptographers.

Enigma Machine
Not all Enigma machines looked alike - they were built over many years with different models and styles. This is one in use in 1943.

The Enigma Machine actually worked quite well and did exactly what its makers claimed. The Enigma's settings offered 150,000,000,000,000,000,000 possible solutions. It never should have been broken. In fact, the Enigma cipher's algorithm was considered quite strong long after the war, and was used in the Unix OS encryption in the 1970s. There is absolutely nothing wrong with the concept behind the machine. Used properly and thoughtfully, it really did provide a secure way to transmit confidential messages. It was this fact, this mathematical guarantee that the machine seemed to offer that lulled the precise Germans into a false sense of security.

A crew aboard U-110 operates the iconic Enigma machine, so valuable to the war effort at sea.

The British Intelligence Service thus would have had great difficulty reading the communications starting from scratch, or even with the Polish breakthroughs. However, they had help besides the Poles. German code books were seized from sinking submarines and captured ships, and some of the Germans operating the machines made it easy to break the code through their simple errors. The British came to see the Luftwaffe operators, members of the newest service who had no tradition of security, as the weak link in the entire operation. Some Luftwaffe coders would send virtually the same messages out every day at regular intervals, morning, noon and night, and if the code they used had changed, the British listening in could compare the messages they had broken with new, identical messages sent with the changed code. This made it relatively easy (not easy - relatively easy) to figure out the changes made to the code itself.

An NSA (National Security Agency) collection of Enigma machines. At far left is a Luftwaffe (Air Force) unit. Next to that is a case holding seven rotors. A Heer (German Army) Enigma is in the center, and a small radio is on the high post next to it. A Kriegsmarine (Navy) unit with four rotors is at far right.

Let's say the weather was good on a particular morning. By listening to them day in and day out, the British cryptographers could figure out that a lazy or careless or simply untrained Luftwaffe operator at a particular forward airfield might send out exactly the same message to headquarters in Paris precisely at 6 a.m. on such a day - "Weather good, conditions all right for operations" or something like that, in exactly the same word formulation every time that was the case. All the British had to do was look out the window, see that it was sunny out, and they knew what message the operator would send that morning. Or, if it was raining, same thing: "Rain over airfield, operations suspended" or something along those lines every single time it rained. All the British had to do then was translate the message backwards to what they knew it said, then work forward from there and crack the entire code. Everything became fairly easy for a trained cryptographer after that sort of hint, especially if supplemented from multiple German sources. The British got so good that they would crow that they were getting the decoded German messages to British officers in the field faster than the German commanders were receiving them.

Enigma Machine
Enigma Machine recovered from a sunk U-Boat off the US coast in 2001. Recovering an actual Enigma machine from a wreck is like finding the Holy Grail for a diver. These can be carefully restored and look almost like they did the day the sub sank.

The Kriegsmarine, on the other hand, was quite punctilious about code protocol. It had been the first military branch to adopt the machine, in 1925, and the German Imperial Navy had a long, proud and competent history. If there is one thing a good Navy understands, it is codes. The navy's operators did not make stupid mistakes. Many naval codes never were broken.

Enigma Machine

Overall, though, by the end of the war, 10 percent of all German Enigma communications were decoded by the code-name "Ultra" team led by Alan Turing at Bletchley Park, in England, using the world’s first electromagnetic computers. However, that means that 90 percent of German communications were not decoded, so it's important not to completely overstate the importance of Enigma.

Enigma Machine

Still, much is made of the effect of breaking the Enigma Code on the outcome of the war. There is absolutely no question that it made things much, much easier for the Allies in many, many situations. Knowing where to position scarce defensive forces before an attack is invaluable information, as is knowing where the enemy is weakest before launching your own attack. There are all sorts of anecdotes about specific instances where breaking Enigma gave the Allies an edge. Winston Churchill told King George VI after World War II that "It was thanks to Ultra that we won the war."

Enigma Machine
German signallers sending an encrypted message via an Enigma machine. Enigma was an electro-mechanical cipher machine based on rotors and was invented toward the end of WW1. First the Poles in 1932 and then the British were able to break the Enigma cipher, the centre for UK code-breaking being Bletchley Park. It has been estimated that intelligence gleaned from decoded Enigma messages shortened WW2 by 2 years.

With all due respect to Winston Churchill, who did certainly have all the facts at his disposal and has to be judged a supreme authority on World War II, that is probably overstating matters. There were larger forces at play in why the Allies won World War II. However, breaking codes helped immensely, and not just in Europe. The Americans broke the Japanese code prior to the decisive Battle of Midway. If they hadn't, there is little doubt that the Japanese would have captured that important island and not lost any aircraft carriers there, let alone four carriers, to US attack. However, no matter how many islands the Japanese captured, they were never going to out-produce and out-invent the United States - it just wasn't going to happen. The United States simply had too many resources, and Japanese such as Admiral Yamamoto knew that all along.

Enigma Machine
Rear of a 'bombe' code-breaking machine at Bletchley Park, 1943. Alan Turing designed the electromagnetic machines to reveal the plugboard settings on German Enigma ciphers.

Germany's major military problem was, in fact, economic: lack of natural resources such as oil; and the huge numbers of enemy soldiers and industrial factories it faced. Intelligence failures were secondary, just as tactics are trumped by strategy. It's more likely that breaking the code shortened the war, but then, the Germans broke Allied codes, too. For example, there was a famous incident of the British ambassador to Turkey having his codes stolen and sold to the Germans by his valet in the so-called Cicero operation. Hitler intercepted secret communications between Franklin Roosevelt and Winston Churchill by having his spies tap the underwater cable between Ireland and Nova Scotia. Code-breaking never was a one-way street, but the victorious powers don't talk about that other side too much. Much better to show how they won the war by not only having more natural resources, but also more smarts in general due to, you know, their better systems of government.

Enigma Machine
German General Heinz Guderian in a SdKfz. 251/3 halftrack vehicle, France, May 1940; note Enigma machine (German Federal Archive)

It is easy to blame the Germans for being stupid for using the Enigma machine. Certainly, a military relying upon an industrial code machine seems kind of silly today. However, the technology was new, and nobody knew its limitations at that point. Using it certainly was more effective than communicating en claire, as the Soviets did at times. The armed forces of many powers used the Enigma Machine, as did diplomatic services and other confidential governmental operations. It is similar to using the Internet today - however clever you may be, it's impossible to know in advance all of its vulnerabilities.

Enigma Machine
German soldiers in Russia

Would the Germans have stopped using the machine if they knew it had been broken? Of course. But nobody knew outside of Allied intelligence services. The secret was guarded as carefully as any in the war. Numerous deaths have been blamed on this policy of secrecy, such as the famous decision not to warn Coventry about an upcoming Luftwaffe attack in November 1940. However, that secrecy paid off in many unexpected ways: after the war, the Allies sold captured Enigma machines to other governments on the cheap. These governments were only too happy to use this "secure" machine while the winning Allied nations who were in on the secret continued to read their codes until the secret finally was revealed in the 1970s. When that happened with the publication of a book, many surviving German Generals from World War II were dumbfounded that they overlooked this hidden source of their defeat defeat.


No comments:

Post a Comment