How Bletchley Park broke the German Enigma code
In part 2 of our series we look at how Enigma was broken and how the first computer was created in the process.
As we found out in part one of our look at Bletchley Park the Polish had given the British a head start on breaking the Enigma code. Unfortunately, the Germans had changed their system for sending the message indicators, making the code harder to break, until Alan Turing had a breakthrough. His idea was to use message cribs, which relied on a flaw in humanity rather than a flaw in the encryption system.
From previous messages, Turing and his team knew that certain stations would always send a broadcast starting with the same phrase, such as the ‘The weather report for today is’. Knowing this, they could take the coded text and know how the first characters would decode. With the knowledge that no letter encrypted could be the same letter decrypted, the number of combinations possible was massively reduced.
Of course, this isn’t as easy as it sounds and finding the initial message was incredibly hard. So hard, in fact, that Bletchley Park had an entire team of people dedicated to finding cribs. Once a crib had been found there was still a need to brute force attack the possible combinations of rotor settings and plugboard.
To do this, Turing devised the Bombe. This electromechanical device acted like 36 Enigma machines, automatically stepping through every single possible rotor setting on a traditional three-rotor Enigma machine. The key point here was that the Bombe was rewired based on the information retrieved from the crib, using a ‘menu’ provided by the cryptographic team.
As the Bombe worked its way through every permutation of rotor settings, electrical current would either flow or not flow through the system, which was checked by the Bombe’s comparator unit. Using this method it was possible to check for a logical contradiction, ruling out particular rotor settings; if there was no contradiction the machine would stop and the rotor settings could be noted down. These could then be tested by hand on a Typex machine modified to work like Enigma. Meanwhile the Bombe could be started again, looking for the next possible solution, until the code had been broken.
Crucially Gordon Welchman, another cryptoanalyst, made an adjustment to the bombe, adding a diagonal board at the rear, which rendered it more efficient in its attack on Engima ciphers. The result was that codes were being broken faster than ever, and the information retrieved was more pertinent.
Admittedly, this is an over simplification of how hard Enigma proved to crack, and it took a lot of hard work and a great deal of genius.
THE PARK GROWS
As the successes with Enigma continued to pile up, so did the requirement for more staff and more room at the Park and increased levels of security. Space was relatively easy to come by and huts were quickly constructed from wood (later brick ones were built) to house teams of cryptographers, each designated with breaking a different type of Enigma code.
Hut 6 was run by Gordon Welchman and was designated with breaking the Army and Air Force Enigma machines. Hut 8 was run by Alan Turing and was designed to break the Naval Enigma encryption. This was made harder by the German Navy’s worry that Enigma was being broken. As a result they used a more secure system of handing out message indicators and switched to using a four-rotor Enigma machine. Fortunately, the Germans also made a crucial mistake.
The four-rotor machine had a lockout wheel on it that meant it could send and receive traditional three-wheel Enigma messages. One day, before the four-rotor Enigma machine was allowed to be used a boat sent a message using all four rotors; realising what they’d done, they had to resend the message using the three-rotor setting. The two messages meant that the Bletchley Park staff could work out the wiring of the fourth wheel having never seen the machine and build the necessary bombe to break the code.
Turing himself was responsible for breaking the naval code, but getting cribs was proving hard, until military action helped him. A code book captured on U-110 gave the Bletchley Park team a list of the Kurzsignalen (Short Signal Code), which where 22 characters long and used to report sightings of possible Allied targets. The codes reduced transmission times and, therefore, the likelihood of being located through direction finding techniques.
Then on 29th or 30th October 1942, U-559 was depth-charged and forced to surface. Three British sailors, Able Seaman Colin Grazier, Lieutenant Francis Anthony Blair Fasson and NAAFI canteen assistant Tommy Brown, swam to the sinking U-Boat and captured code books with all of the current U-boat Enigma keys, plus the Wetterkurzschluessel (Weather Short Code Book). Between the code books, Turing and his team had a vital source of cribs to look out for.
THE LORENZ MACHINE
While the main focus of Bletchley Park was breaking Enigma, the cryptologists were also tasked with breaking the Lorenz cipher, whose traffic was known as Tunny. This was created by Lorenz machines, which were far larger, and therefore not portable, but much more complex than Enigma.
These machines were teleprinters that output messages not as text, but as each character composed as in five-bit baudot code. To encrypt the data, the Lorenz machine generated five pseudorandom bits, which were XORed with the plaintext. This operation looks at pairs of bits, and outputs a 1 if only one of the characters is a 1, otherwise the output is 0. So 1 XOR 0 = 1, but 1 XOR 1 = 0. Each character output in the Lorenz machine would be XORed with the pseudorandom bits, such as: 10010 XOR 11001 = 01011. The important thing about XOR operations is that XORing the output with the pseudorandom bits reverses the encryption, so, 01011 XOR 11001 = 10010.
The Lorenz machine generated its pseudorandom bits through a set of ten pinwheels, where the encryption key was determined by the starting position of the wheels. There were five pinwheels which stepped regularly (chi) and five which stepped irregularly (psi). The irregular stepping of the psi wheels was controlled by two extra wheels, called the motor wheels. The Lorenz machine actually double-encrypted the data, first generating a five-bit pseudorandom code for the chi wheels, then generating a second five-bit pseudorandom code for the psi wheels. However, the order in which these are applied, both in encrypting and decrypting, are not important.
STATISTICAL ATTACK AND COLOSSUS
W. T. (Bill) Tutte working at Bletchley Park discovered how to break Lorenz using statistical methods to break both parts of the key: the pin settings for the wheels (known as wheel breaking) and the wheel setting (the starting positions of each wheels). The wheel breaking was often done by hand, using Tutte’s rectangling method, which involved writing down the bits of message in a rectangle, then statistically analysing the results for patterns that gave away the pin positioning.
Once this had been worked out, the starting positions of the wheels could be worked out. Tutte worked out was that the psi wheels were a weak point in the encryption, as they moved irregularly. Therefore, the output from these wheels was the same for many characters. As such, the important thing was to start with the regularly stepping chi wheels.
Tutte also worked out that you could work on pin wheels in pairs. So, while there were 22 million possible wheel start positions, there were just 1,271 possible starting combinations for the first chi wheels. Due to the way the system worked, guessing the first two chi wheels would remove the first two encrypted bits throughout the entire message. It was then possible using the partially decrypted code to statistically analyse the result looking for patterns, whereby a character is repeated twice in a row, such as in the English word, look, which has ‘o’ repeated twice. This is statistically very likely in German, too.
From there, assuming the first two wheels are set correctly, there were only 598 combinations of starting positions for the last two wheels. Once they were set, this left just 29 positions for the third wheel, meaning that only 1,898 starting combinations were needed to break the chi wheels. Once this was complete breaking the Psi wheels was considerably easier.
The only problem now was to automate the problem, which is where Max Newman came in, as he believed it was possible to build a machine to automatically perform some of the calculations. The initial machines, named Heath Robinson, proved unreliable but were a good starting point for Tommy Flowers, who decided you can build an electronic machine for reading cipher text, performing the necessary calculations and outputting the results on a printer. In other words, the first computer, Colossus, was born.
Initially its job was to optically read in ciphertext characters, and count repeated characters on them for all of the combinations of the chi wheels, based on its programmed wheel settings, outputting the results to a printer. The lines with the highest counts above a set statistical value where the most likely chi wheel settings. These were passed onto to a team that would break the easier psi values by hand and check the chi settings manually, decoding messages on a replica Tunny machine.
Operating at 5,000 characters per second, Colossus was capable of working out the chi settings in less than 30 minutes. However, it was also discovered that Colossus could be programmed for wheel breaking, massively reducing the time that this took.
The combination of the Bombes and Colossus ensured that the Allies had full knowledge of what the Germans were up to, giving them vital information that dramatically helped the war effort. In part 3 of our feature we’ll see what this success meant and how Bletchley Park needs help now.