The Lorenz SZ40/42 cipher attachment - FISH and TUNNY

In 1940 a listening unit of the British Police Force which was assigned to monitor the airwaves for possible activity by German agents intercepted a new type of transmission - a non-Morse signal. The German military were using a new type of encryption device to encipher messages transmitted, by both radio and land line, in the international Baudot teleprinter code. Two different cipher machines were involved - the Siemens und Halske T52; a stand-alone enciphering teletype device and the Lorenz SZ40 - and later the SZ42 - which was an enciphering attachment intended for use with a standard teleprinter and named Schlüsselzusatz [key-addition] by the German military authorities.

Bletchley Park gave the codename 'Fish' to the overall teleprinter traffic and the codename 'Tunny'  to the material enciphered by the Lorenz SZ40/42.

The first real break into Tunny traffic occurred on August 30, 1941 when a cipher clerk in Vienna sent a long message - four thousand or so characters - to his opposite number in Athens. When he had finished this formidable typing effort he received a reply which was the German equivalent of "I didn't get all that. Please send it again..!". So he did - using, against all established principles of cipher security, the same machine settings that he had used for the first transmission. He also used a number of abbreviations [e.g. 'Spruchnummer' became 'Spruchnr' , etc.]. This egregious error was the chance for which BP was waiting and a team headed by Colonel [later Brigadier] John Tiltman deciphered the message in short order.

Tiltman passed the material along to a young Cambridge mathematician, Bill Tutte, who immediately set to work in a attempt to determine the principle by which the Lorenz machine worked. Incredibly, only four months later Tutte and BP had a working knowledge of the internals of the machine and were able to build an electro-mechanical analogue - the Tunny machine.

The Lorenz SZ40/42 was a very complex cipher device and no brief presentation such as this can do justice to its complexity or attempt to do more than just present an overall, much simplified, view of its operational principles.

The SZ40/42 worked thus... A character was entered from a teleprinter - either from the keyboard or from tape. Each character in the Baudot telegraphic code consisted of five 'bits'  - each punched into the tape as a 'hole' or a 'space'. The letter 'A' was represented as 'hole/hole/space/space/space', or in modern, computer terms 11000. Lorenz acted upon each individual 'bit' by adding a two part key, modulo two - in modern terms, XOR. The SZ40/42 had twelve wheels in total - five designated 'K' or Chi wheels, five designated 'S' or Psi wheels, and two 'motor' wheels M1 and M2. The 'K' wheels acted first, in unison, on the character - each wheel on one individual   'bit'. Through a series of relays they added a random key to the input character. A second key was added by the 'S' wheels, also acting in unison. The block of five 'K' wheels moved once with each character input while movement of the 'S' wheels, which also moved as a block of five but not with every input, was controlled by the settings of M1 and M2. While the 'K' wheels moved with every character processed the 'S' wheels moved randomly, on average only about two thirds of the time.

A particular 'K' or 'S' wheel contributed to the key in the following way.  Each wheel carried a different number of pins or 'camlets' - K1/41, K2/31, K3/29, K4/26, K5/23: S1/43, S2/47, S3/51, S4/53, S5/59: M1/61, M2/37 - the numbers of pins on each wheel being relatively prime to those on all other wheels. The pins were selected 'on' or 'off' as part of the machine setup. In the case of the 'K' and 'S' wheels if a pin was 'on', the state of the corresponding component of the five-bit character was altered - if the pin was 'off' the component remained unaltered.. The M1 wheel moved with the 'K' wheels. If the pin on the M1 wheel was 'on' then the M2 wheel moved with the next input. If the pin on the M2 was 'off' the 'S' wheels moved, together as a unit, with the next character input: if the M2 pin was 'on', the 'S' wheels did not move. Note the reverse logic between M1 and M2.

An example is given in the table below:

Plaintext 'A' in the Baudot Code is represented by the 'five-bit' 11000
'K' wheels - pins off/on/off/on/off - change each bit accordingly 10010
Add this pair - Mod2/XOR  01010
'S' wheels - pins on/off/off/off/on - change each bit accordingly 11011
Add - Mod2/XOR - for a ciphertext character output of 'Z' 10001

[Note: In practice, the actions of the 'K' and 'S' wheels were simultaneous - not sequential]

Thus - if 'A' is the character typed into the Lorenz - 'Z' is transmitted. Since the SZ40/42 used the entire character set of the Baudot code the output was not restricted to the A-Z letters of the alphabet.

In another example: the plaintext...
    AUF BEFEHLD DES OBERSTEN BEFEHLSHABERS SIND IM FALLE...
...resulted in the following ciphertext...
    AICMRAGXCXQYUUMCRIJUMO6CBXWMDDCYUWKRBWR2F1PUVYLK6W2QS665BR46LTEKTM...

Once Bletchley Park had developed a  hand method for breaking into the Lorenz traffic it was essential that the process be speeded up and a search for a means of automating the key search process began. The rest is history. The search of course culminated in the development - by Tommy Flowers and his Post Office team, and many others - of Colossus and of Tunny, an electro-mechanical analogue of the Lorenz cipher attachment. It is hoped that simulations of the Lorenz machine and also of Colossus and Tunny will be released shortly by the Crypto Simulation Group.

For a more detailed description of the SZ40/42 machines and much more on the part played by Colossus the following references may prove useful:

Reference:
1:    Carter, F., Codebreaking with the Colossus Computer, Bletchley Park Report  #1, 1996
2:    ----------, Codebreaking with the Colossus Computer, Bletchley Park Report  #3, 1997 [information]
3:    ----------, Codebreaking with the Colossus Computer, Bletchley Park Report  #4, 1997
4:    Davies, D.W., The Lorenz Cipher Machine SZ42, Cryptologia XIX(1) pp 39-61, 1995
5:    Erskine, R., Tunny Decrypts, Cryptologia XII(1) pp 59-61, 1988
6:    Fox, B. & Jeremy Webb, Colossal Adventures, New Scientist Vol.154/No.2081, 1997
7:    Hinsley, F.H. & Alan Stripp, Codebreakers, Oxford University Press, 1993      
8:    Tutte, W.T., Fish and I, University of Waterloo lecture transcript, 1998 [download]

Audio: To hear the sound of a SZ40/42 transmission click here [.wav capability required]

Home ] Up ]