by Ruthie Gawley
Let me lay out our puzzle: it’s 1940, and the first soldiers are laying down their lives for their countries, while the first civilians are martyred by whistling bombs. A plague of war is ripping across the world, and only one weapon can be harnessed to halt its devastating path: Information. Decoding messages to discover the enemy’s secrets. No code is more at the forefront than the much overlooked Tunny code system; more complex than even the famous Enigma, it concealed commands sent directly from Nazi high command. The knowledge that could be gained from cracking Tunny might be the difference between winning and losing the war - the stakes were higher than ever. Hidden within the dot-cross code of Tunny, is a story of mathematics, logic and genius like no other.
Before you understand Tunny, you need to know about the teleprinter. During that period, machines called teleprinters were used to send messages across long distances, by converting the letters that were typed on the machine into sequences of electrical signals, not unlike morse code. For example, if you typed “A” in teleprinter code, it would be transmitted as “xx•••” - pulse, pulse, no pulse, no pulse, no pulse. These teleprinter signals can be written in grids, with each column representing a letter and each row what cryptanalysts called an ‘impulse’. See Figure A for an example of a basic teleprinter transmission.
Because everyone knew the teleprinter alphabet, teleprinter transmissions weren’t secure at all, but this all changed if you attached a Tunny Machine - more technically known as a Lorenz SZ40. The Lorenz SZ40s turned recognisable signals into scrambled gibberish, by generating a key. To explain this process, let's start with the basics - a Tunny teleprint attachment had 12 wheels, and each spun around different numbers of times before completing a full circle, producing a pulse or no pulse at each stop. You can think of this as a cog with teeth, revolving just one tooth every time it is told to spin.
5 of these cog-like wheels immediately revolve one tooth every time someone types a letter in the printer. Called the chi-wheels, these will either produce a pulse (x) or no pulse (•) at each tooth, like all Tunny wheels. Because there are 5 wheels, and a teleprinter letter is 5 dot/crosses long, each spin results in the chi-wheels forming one letter. For a piece of text which is 10 letters long, the list of letters generated by these 5 cogs (christened the chi-stream) could be, for example, GPIODPMATT.
The next 5 wheels are called the psi-wheels. Contrastingly, these wheels have staggered movements. Every time a letter is typed, the psis might all move, or they might all stay still (the final two wheels of the 12 decide this reasonably randomly). Like the chis, the psis produce a whole letter every time a character is typed into the teleprinter. If the psis don’t move, the same letter as last time is produced. Therefore, the psi-stream looks more like this: JJJFFEEEHH
You’re probably wondering what we are going to actually do with our chi-stream and psi-stream, to turn them into a key which will somehow encipher the plaintext message. That comes down to the simple beauty of teleprinter addition:
Dot + Dot (no change) = Dot
Cross + Cross (no change) = Dot
Dot + Cross (change) = Cross
Cross + Dot (change) = Cross
The elegance of this addition system is that you can take any letter in teleprinter code, say T(••••x), and add another letter, say R (•x•x•) and produce the sum, here G (•x•xx). However, if you then add R to G, you get back to T (try it for yourself!). This even works when adding multiple letters - if you added T, Q and R, to make F, then added Q again, you would get back to G (the sum of T and R)!
With this system, you can add together the psi-stream and chi-stream; having two streams makes Tunny much more difficult to break. Then, you can take this total sum of the streams, called the key, and add it to the plaintext. This method is shown in Figures B and C. To anyone intercepting, this completely conceals the plaintext. However, due to the system of teleprinter addition, all the receiving German has to do it make sure his Tunny machine’s wheels are starting on the same tooth of their cogs as the sender, and are set up to produce signals/no signals in the same teeth.
Every time the sender types a plaintext character, both the sender and receiver’s Tunny Machines produce the same letter, as they have the same settings. The sender adds the letter to the plaintext (to create ciphertext), and when the receiver gets the ciphertext they need only add that same letter to the ciphertext, to zero the key out and get the plaintext. But the Bletchley Park analysts have no idea what out of the thousands of possible wheel settings, for all 12 wheels, they are using!
For Bletchley Park codebreakers, Tunny was at first a total mystery. How are you supposed to crack something that generates a key every time a letter is typed? But throughout the war, genius methods of breaking Tunny were devised. Today, I want to detail the most significant one, that would lead to the end of Tunny.
It was Alan Tutte, an eccentric mathematician, who devised this method, called “2 + 1”. Pivotal to this was a way of tracking changes throughout the ciphertext by using the technique delta, 𝚫. This is achieved by taking each two consecutive signals of cipher text and adding them together with teleprinter addition. That means if the two letters are different, the result will be a cross. If they are the same, the result is a dot- see Figure D for more detail.
To find more patterns, Tutte looked closely at the individual impulses of the ciphertext, and the components that made them up. Tutte knew that the delta of the ciphertext in any impulse was composed of the delta of the plaintext, psi-stream and the chi-stream of that impulse.
𝚫Ciphertext1 = 𝚫(Plaintext1 +chi1+psi1) - 1 stands for first impulse.
He noticed that the delta of the psi-stream of all the impulses was very regular. Because the psi-wheels are staggered - they often stay in the same place and produce the same signals- the delta of the psi-stream was often •••••. Every wheel’s delta-ed contribution was a dot, because every wheel didn’t change if it produced a signal or not, and the dot represents no change. However, if there is a change and the psi-wheels move on, the result of the delta is a normal teleprinter letter. (See Figures D and E for more clarity). In normal teleprinter letters, there is about a 50% likelihood your letter will be a dot, and about 50% for a cross.
As a result, the probabilities of dots or crosses appearing in the psi-streams becomes very skewed. About half the time, all of the symbols are dots because the wheel hasn’t moved. About 25% of the time, the wheels have moved and the normal teleprinter letter is a dot. Only 25% of the time, the wheels have moved and the normal teleprinter letter is a cross. With some irregularities accounted for, actually 70% of delta psi-stream symbols are dots.
Therefore, you can take the delta of the first impulse of the ciphertext and add it to the second impulse. Because the delta psi-streams within the ciphertext impulses (Ciphertext = plaintext + chi + psi) both have a 70% dot abundance, when you add them together, they are (a little less than) 70% the same and so partially cancel out. Remember, if you have a sum (the ciphertext) and you add one of its components to it (the psi-stream) that component is zeroed out. When you add together the first two impulses, you partially zero out the psi from both of them, leaving you only with the sum of the delta plaintexts and chi-streams as well as the remnants of the psi-stream that the not completely complete addition mostly cancels out.
Although this was a start, mostly removing psi, Tutte hadn’t stripped Tunny down to its bones yet. However, to his delight, he discovered that the delta of the plaintext also had regularities. Simply because of the way the German language worked and how it was rendered in teleprinter code, delta of the plaintet had a 60% dot abunancy. For that reason, adding the first two impulses together resulted in the two delta plaintexts also partially cancelling out.
The ciphertext of impulse one plus the ciphertext of impulse two was the same as partially removing the plaintext and psi-stream, and being left with only a slightly warped version of the final component, the two chi-streams added together; slightly confused by the remnants of the psi and plaintext. Tutte found that adding the two impulses in this way resulted in a 55% accurate delta of chi1+chi2.
Now, Tutte realised he could go through every possible wheel setting for the chi wheels (every single starting position) and count the number of times the delta of chi1 + chi2 for wheel setting he was testing agreed with his slightly confused delta chi1 plus chi2 he has calculated for the message.
Arguably, the wheel setting with the most agreements was the wheel setting for the Tunny ciphertext in question. They would never completely agree, because Tutte’s delta of chi1 plus chi2 was so mangled, but the wheel setting which was correct around 55% (the accuracy of Tutte’s delta chi1 plus chi2) the most was probably the correct one.
The problem was, the woman power needed to check every single possible starting position of the chi wheels was huge. There were 41 starting positions (41 teeth) on the first wheel of the chi, and 31 for the second wheel. That means 41x31 = 1271 possibilities!
The electrical engineers at Bletchley weren’t phased though, and soon an automated system, an early resemblance of a computer, was created to achieve this. The result of chi1 plus chi2 for the first wheel settings of the 1271 possibilities was run alongside our mangled estimate for chi1 plus chi2. The agreements were counted, and then the tape that contained the chi-stream of the wheel settings was shifted one place along - to start in the next possible starting place of the 1271 possibilities. 1269 runs later, and the most probable chi wheel settings were found. This machine was later updated when the 2 +1 method became more sophisticated, and by the end of the war it was considered one of the first real computers.
Once you have the chi wheel settings, you can actually fully remove the chi-stream from the ciphertext, by simply calculating the correct chi1 and chi2 and removing it. Then, you only have psi-stream and plaintext, and the Bletchley Park codebreakers could manipulate that the psi repeats itself so much to crack the two apart using pen and paper, like the way a typical puzzle like sudoku or a crossword is solved. When you guess a letter, there are more clear possibilities for the next, and as soon as some plaintext starts to reveal itself it is easier to work out what comes next in the message. Finally, you can work out the other wheel settings from the stripped down components of the ciphertext, and you then have a broken cipher. When they had all the wheel settings, they could calculate the entire key, remove it, and read the massage!
Tutte’s method of breaking into Tunny was one of the most significant and overlooked victories in the war. The top-secret information concealed in Tunny included Nazi intell that allowed the allies to go ahead with D-Day, assured that German troops didn’t await them. It was pivotal in the Battle of the Atlantic, and the snapshot it gave into the plans Nazi high command - genuine messages from Hitler - was invaluable. The logic and mathematical beauty behind Tunny is also unrivalled, and the influence of the development of the computers to break it was profound. Many of those who worked on Tunny went on to pioneer the computer age.
Comments
Post a Comment
Comments with names are more likely to be published.