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.
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.