page_title: Cryptanalysis of the Lorenz cipher
section_title: The German Tunny machines
hierarchical_section_title: Cryptanalysis of the Lorenz cipher / The German Tunny machines
caption_attribution_description: English: Close-up of the cams on wheels 9 and 10 of the Lorenz SZ42 showing their raised (active) and lowered (inactive) positions. An active cam reversed the value of a bit (0→1 and 1→0).
context_page_description: Cryptanalysis of the Lorenz cipher was the process that enabled the British to read high-level German army messages during World War II. The British Government Code and Cypher School at Bletchley Park decrypted many communications between the Oberkommando der Wehrmacht in Berlin and their army commands throughout occupied Europe, some of which were signed "Adolf Hitler, Führer". These were intercepted non-Morse radio transmissions that had been enciphered by the Lorenz SZ teleprinter rotor stream cipher attachments. Decrypts of this traffic became an important source of "Ultra" intelligence, which contributed significantly to Allied victory.
  For its high-level secret messages, the German armed services enciphered each character using various online Geheimschreiber stream cipher machines at both ends of a telegraph link using the 5-bit International Telegraphy Alphabet No. 2. These machines were subsequently discovered to be the Lorenz SZ for the army, the Siemens and Halske T52 for the air force and the Siemens T43, which was little used and never broken by the Allies.
context_section_description: The Lorenz SZ cipher attachments implemented a Vernam stream cipher, using a complex array of twelve wheels that delivered what should have been a cryptographically secure pseudorandom number as a key stream. The key stream was combined with the plaintext to produce the ciphertext at the transmitting end using the exclusive or (XOR) function.  At the receiving end, an identically configured machine produced the same key stream which was combined with the ciphertext to produce the plaintext, i. e. the system implemented a symmetric-key algorithm.
  The key stream was generated by ten of the twelve wheels. This was a product of XOR-ing the character generated by the right hand five wheels, the chi () wheels, and the left hand five, the psi () wheels. The chi wheels always moved on one position for every incoming ciphertext character, but the psi wheels did not.
  The central two mu () or "motor" wheels determined whether or not the psi wheels rotated with a new character. After each letter was enciphered either all five psi wheels moved on, or they remained still and the same letter of psi-key was used again. Like the chi wheels, the ₆₁ wheel moved on after each character. When ₆₁ had the cam in the active position and so generated x (before moving) ₃₇ moved on once: when the cam was in the inactive position (before moving) ₃₇ and the psi wheels stayed still. On all but the earliest machines, there was an additional factor that played into the moving on or not of the psi wheels. These were of four different types and were called "Limitations" at Bletchley Park. All involved some aspect of the previous positions of the machine's wheels.
  The numbers of cams on the set of twelve wheels of the SZ42 machines totalled 501 and were co-prime with each other, giving an extremely long period before the key sequence repeated. Each cam could either be in a raised position, in which case it contributed x to the logic of the system, reversing the value of a bit, or in the lowered position, in which case it generated •.  The total possible number of patterns of raised cams was 2⁵⁰¹ which is an astronomically large number. In practice, however, about half of the cams on each wheel were in the raised position. Later, the Germans realized that if the number of raised cams was not very close to 50% there would be runs of xs and •s, a cryptographic weakness.
  The process of working out which of the 501 cams were in the raised position was called "wheel breaking" at Bletchley Park. Deriving the start positions of the wheels for a particular transmission was termed "wheel setting" or simply "setting". The fact that the psi wheels all moved together, but not with every input character, was a major weakness of the machines that contributed to British cryptanalytical success.
caption: Cams on wheels 9 and 10 showing their raised (active) and lowered (inactive) positions. An active cam reversed the value of a bit (•→x and x→•).
exif: {"Image ImageWidth": "4416", "Image ImageLength": "3312", "Image BitsPerSample": "[8, 8, 8]", "Image PhotometricInterpretation": "2", "Image Make": "Canon", "Image Model": "Canon PowerShot G10", "Image Orientation": "Horizontal (normal)", "Image SamplesPerPixel": "3", "Image XResolution": "180", "Image YResolution": "180", "Image ResolutionUnit": "Pixels/Inch", "Image Software": "Adobe Photoshop Elements 11.0 Windows", "Image DateTime": "2015:02:25 19:12:32", "Image YCbCrPositioning": "Co-sited", "Image ExifOffset": "300", "Thumbnail Compression": "JPEG (old-style)", "Thumbnail XResolution": "72", "Thumbnail YResolution": "72", "Thumbnail ResolutionUnit": "Pixels/Inch", "Thumbnail JPEGInterchangeFormat": "1222", "Thumbnail JPEGInterchangeFormatLength": "10721", "EXIF ExposureTime": "1/60", "EXIF FNumber": "9/2", "EXIF ISOSpeedRatings": "250", "EXIF ExifVersion": "0221", "EXIF DateTimeOriginal": "2015:02:25 12:30:23", "EXIF DateTimeDigitized": "2015:02:25 12:30:23", "EXIF ComponentsConfiguration": "YCbCr", "EXIF CompressedBitsPerPixel": "5", "EXIF ShutterSpeedValue": "189/32", "EXIF ApertureValue": "139/32", "EXIF ExposureBiasValue": "-2", "EXIF MaxApertureValue": "139/32", "EXIF MeteringMode": "Pattern", "EXIF Flash": "Flash fired, auto mode, red-eye reduction mode", "EXIF FocalLength": "61/2", "EXIF FlashPixVersion": "0100", "EXIF ColorSpace": "sRGB", "EXIF ExifImageWidth": "2484", "EXIF ExifImageLength": "2098", "Interoperability InteroperabilityIndex": "R98", "Interoperability InteroperabilityVersion": "[48, 49, 48, 48]", "Interoperability RelatedImageWidth": "4416", "Interoperability RelatedImageLength": "3312", "EXIF InteroperabilityOffset": "1072", "EXIF FocalPlaneXResolution": "1104000/73", "EXIF FocalPlaneYResolution": "1104000/73", "EXIF FocalPlaneResolutionUnit": "2", "EXIF SensingMethod": "One-chip color area", "EXIF FileSource": "Digital Camera", "EXIF CustomRendered": "Normal", "EXIF ExposureMode": "Manual Exposure", "EXIF WhiteBalance": "Auto", "EXIF DigitalZoomRatio": "1", "EXIF SceneCaptureType": "Standard"}