# The Lorenz Cipher

## and how Bletchley Park broke it

### by Tony Sale

| Back to Fish Index |

Tony Sale's
Codes and Ciphers

## The German Lorenz cipher system

The German Army High Command asked the Lorenz company to produce for them a high security teleprinter cipher machine to enable them to communicate by radio in complete secrecy. The Lorenz company designed a cipher machine based on the additive method for enciphering teleprinter messages invented in 1918 by Gilbert Vernam in America. Teleprinters are not based on the 26-letter alphabet and Morse code on which the Enigma depended. Teleprinters use the 32-symbol Baudot code. Note that the Baudot code output consists of five channels each of which is a stream of bits which can be represented as no-hole or hole, 0 or 1, dot or cross.
 The Baudot Code
The Vernam system enciphered the message text by adding to it, character by character, a set of obscuring characters thus producing the enciphered characters which were transmitted to the intended recipient. The simplicity of Vernam's system lay in the fact that the obscuring characters were added in a rather special way (known as modulo-2 addition). Then exactly the same obscuring characters, added also by modulo-2 addition to the received enciphered characters, would cancel out the obscuring characters and leave the original message characters which could then be printed. The working of modulo-2 addition is exactly the same as the XOR operation in logic. If A is the plain-text character, and C the obscuring character, then in the table below, F is the cipher-text character. You can also see from this table that the addition of C to F brings you back to A again:
A + C = F      F + C = A
x + . = x      x + . = x
x + x = .      . + x = x
. + x = x      x + x = .
. + x = x      x + x = .
. + . = .      . + . = .
Vernam proposed that the obscuring characters should be completely random and pre-punched on to paper tape to be consumed character by character in synchrony with the input message characters. Such a cipher system (a 'one-time pad system') using purely random obscuring characters is unbreakable.
The difficulty was how to ensure, in a hot war situation, that the same random character tapes were available at each end of a communications link and that they were both set to the same start position. The Lorenz company decided that it would be operationally easier to construct a machine to generate the obscuring character sequence. Because it was a machine it could not generate a completely random sequence of characters. It generated what is known as a pseudo-random sequence. Unfortunately for the German Army it was more "pseudo" than random and that was how it was broken.
 The amazing thing about Lorenz is that the code breakers in Bletchley Park never saw an actual Lorenz machine until right at the end of the war but they had been breaking the Lorenz cipher for two and a half years.

## The first intercepts

The teleprinter signals being transmitted by the Germans, and enciphered using Lorenz, were first heard in early 1940 by a group of policemen on the South Coast who were listening out for possible German spy transmissions from inside the UK. Brigadier John Tiltman, one of the top code breakers in Bletchley Park, took a particular interest in these enciphered teleprinter messages. They were given the code name "Fish". The messages which (as was later found out) were enciphered using the Lorenz machine, were known as "Tunny". Tiltman knew of the Vernam system and soon identified these messages as being enciphered in the Vernam manner. Because the Vernam system depended on addition of characters, Tiltman reasoned that if the operators made a mistake and used the same Lorenz machine starts for two messages (a depth), then by adding the two cipher texts together character by character, the obscuring character sequence would disappear. He would then be left with a sequence of characters each of which represented the addition of the two characters in the original German message texts. For two completely different messages it is virtually impossible to assign the correct characters to each message. Just small sections at the start could be derived but not complete messages.

## The German mistake

As the number of intercepts, now being made at Knockholt in Kent, increased a section was formed in Bletchley Park headed by Major Ralph Tester and known as the Testery. A number of Depths were intercepted but not much headway had been made into breaking the cipher until the Germans made one horrendous mistake. It was on 30 August 1941. A German operator had a long message of nearly 4,000 characters to be sent from one part of the German Army High command to another — probably Athens to Vienna. He correctly set up his Lorenz machine and then sent a twelve letter indicator, using the German names, to the operator at the receiving end. This operator then set his Lorenz machine and asked the operator at the sending end to start sending his message. After nearly 4,000 characters had been keyed in at the sending end, by hand, the operator at the receiving end sent back by radio the equivalent, in German, of "didn't get that — send it again".
They now both put their Lorenz machines back to the same start position. Absolutely forbidden, but they did it. The operator at the sending end then began to key in the message again, by hand. If he had been an automaton and used exactly the same key strokes as the first time then all the interceptors would have got would have been two identical copies of the cipher text. Input the same — machines generating the same obscuring characters — same cipher text. But being only human and being thoroughly disgusted at having to key it all again, the sending operator began to make differences in the second message compared to the first.
The message began with that well known German phrase SPRUCHNUMMER — "message number" in English. The first time the operator keyed in S P R U C H N U M M E R. The second time he keyed in S P R U C H N R and then the rest of the message text. Now NR means the same as NUMMER, so what difference did that make? It meant that immediately following the N the two texts were different. But the machines were generating the same obscuring sequence, therefore the cipher texts were different from that point on. The interceptors at Knockholt realised the possible importance of these two messages because the twelve letter indicators were the same. They were sent post-haste to John Tiltman at Bletchley Park. Tiltman applied the same additive technique to this pair as he had to previous Depths. But this time he was able to get much further with working out the actual message texts because when he tried SPRUCHNUMMER at the start he immediately spotted that the second message was nearly identical to the first. Thus the combined errors of having the machines back to the same start position and the text being re-keyed with just slight differences enabled Tiltman to recover completely both texts. The second one was about 500 characters shorter than the first where the German operator had been saving his fingers. This fact also allowed Tiltman to assign the correct message to its original cipher text. Now Tiltman could add together, character by character, the corresponding cipher and message texts revealing for the first time a long stretch of the obscuring character sequence being generated by this German cipher machine. He did not know how the machine did it, but he knew that this was what it was generating!

## The dénouement

John Tiltman then gave this long stretch of obscuring characters to a young chemistry graduate, Bill Tutte, who had recently come to Bletchley Park from Cambridge. Bill Tutte started to write out the bit patterns from each of the five channels in the teleprinter form of the string of obscuring characters at various repetition periods. Remember this was BC, "Before Computers", so he had to write out vast sequences by hand.
 Bill Tutte (left) with Tony Sale, in about 1998.
When he wrote out the bit patterns from channel one on a repetition of 41, various patterns began to emerge which were more than random. This showed that a repetition period of 41 had some significance in the way the cipher was generated. Then over the next two months Tutte and other members of the Research section worked out the complete logical structure of the cipher machine which we now know as Lorenz:
 Outline of the structure of the Lorenz cipher machine
This was a fantastic tour de force and at the beginning of 1942 the Post Office Research Labs at Dollis Hill were asked to produce an implementation of the logic worked out by Bill Tutte & Co. Frank Morrell produced a rack of uniselectors and relays which emulated the logic. It was called "Tunny". So now when the manual code breakers in the Testery had laboriously worked out the settings used for a particular message, these settings could be plugged up on Tunny and the cipher text read in.
 A Tunny Machine
If the code breakers had got it right, out came German. But it was taking four to six weeks to work out the settings. This meant that although they had proved that technically they could break Tunny, by the time the messages were decoded the information in them was too stale to be operationally useful.

The lecture Fish and I, by Bill Tutte, gives more information on the structure of the Lorenz pseudo-random sequence and the methods developed to break Lorenz-enciphered messages. In particular it explains the 'double-delta' method which was an important element of the mechanisation programme that now ensued.

 This page is created by Tony Sale (tsale@qufaro.demon.co.uk) the original curator of the Bletchley Park Museum