Friday, May 30, 2014

Cracking the Enigma Machine

The Machine that Lost World War II for the Germans

Enigma Machine
Very Rare WWII Enigma Cipher Machine. This highly important three-rotor Enigma deciphering machine was used by the Germans 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.

Wireless transmissions were critical to the Wehrmacht's "Blitzkrieg" operations. These relied on close communication between ground and air units, with ground-attack planes hitting targets requested by the ground troops. While telephones were used for official communications within Germany, radios were used outside the borders. Those communications had to be encoded, and the Enigma machine was the tool of choice.

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

Enigma Machine Use By The Germans

The use of the Enigma machine was not a Third Reich idea. In fact, it was advertised for commercial use in catalogs beginning in 1923 to anyone willing to pay for it. The German military had adopted the machine well before Hitler took power in 1933, with the German Navy being the first to use it in 1926. The military modified the Enigma machine to include a plugboard and other enhancements to make it more secure.

The Poles, Germany's natural enemy during the inter-war period, became interested in this new machine also. The first Enigma machine in Allied hands was ‘acquired’ by Polish intelligence in 1938 by setting up a fake German arms company and ordering a civilian version. The Poles 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 for making the breakthroughs that the Ultra team later capitalized on. They continued reading the codes through the 1930s, but towards the end of the decade, the Germans starting embellishing the machine and adding new embellishments 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 the 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 German changes to the Enigma machine (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 original machine was lost, but an accurate copy was reverse-engineered from Polish drawings by Bletchley Park technicians.

The Polish cryptographers had to leave Poland in a hurry that autumn, 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.

At 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" center 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 like they - 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.

U-110 Enigma Machine
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 codebooks 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 Polares Incident

On 24 April 1940, two British destroyers, HMS Griffin and Acheron, were on patrol in the North Sea when they stopped a merchant ship for inspection off Andalsnes, about halfway between Bergen and Trondheim on the Norwegian coastline. The ship's captain claimed that it was an ordinary Dutch trawler. The British boarding party from Griffin did a thorough inspection and found that it was the disguised Kriegsmarine surface raider Schiff 26 - the Polares. It was trying to bring supplies to Narvik.

The German crew acted quickly and threw a weighted bag overboard. The British acted even quicker and retrieved the bag before it sank. It turned out to contain some of the German Enigma machine coding machine keys for the period 23–26 April 1940, including the procedures for scrambling the rotors.

HMS Griffin Enigma Machine
The crew of HMS Griffin (H31), shown, was responsible for one of the biggest Ultra advances of World War II.
These Enigma items were quickly sent to Bletchley Park, site of the Ultra decoding project. The cryptanalysts there under the direction of Alan Turing used the seized information to program their "Bombe" electro-mechanical computers. The machines then proved that they could decode German transmissions from this time period.

This was a clear breakthrough for the Ultra team. Now, they had proven that their system works. From this point on, the Royal Navy is tasked with finding new "cribs" such as the ones from the Polares to enhance their code-breaking. Ultimately, this enabled the Bombes to break German codes routinely even without recent cribs.

The U-559 Incident

On 30 October 1942, Royal Navy destroyer HMS Petard and vessels and aircraft accompanying it forced U-boat U-559 to the surface off the coast of Egypt. The U-boat crew surrendered and attempted to flood the submarine to avoid capture by opening the sea vents. However, they failed to open all of them and the submarine sank relatively slowly. Three random men of the Petard crew boarded the sinking U-boat to retrieve whatever they could.

Two of the men perished in the U-board. The third man, NAAFI canteen assistant Tommy Brown, came out with the submarine's Enigma machine key setting sheets and other relevant documents. All three men received medals, two posthumously.

HMS Petard Enigma Machine
HMS Petard.
Incidentally, it turned out that the survivor, Brown, had lied about his age and was only sixteen years old. After receiving his medal he was quickly discharged from the service.

The information from U-559 helped the cryptanalysts at Bletchley Park to read the new 4-rotor U-boat Enigma machine. This proved to be a critical breakthrough in the Ultra program. After this, the Ultra team could read U-boat codes and direct convoys away from lurking submarines. This incident was the basis for the motion picture "U-571" (2000).

Routine Decryption

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.

Enigma Machine
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 the 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 how to handle 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 an 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 the electro-mechanical cipher machine used for coded German wireless transmission. It was 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 center for UK code-breaking being Bletchley Park. It has been estimated that intelligence gleaned from decoded Enigma messages shortened WW2 by 2 years (Federal Archive).
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
The 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 an SdKfz. 251/3 half-track 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 using an Enigma machine (Federal Archive).
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.


No comments:

Post a Comment