# How were codes in WW1 reciphered (to enhance security levels) without them turning meaningless?

In WW1 the Germans made their communicating secret by encoding their messages. This meant that the sender of the message would have a codebook with all possible words and phrases he might use listed in alphabetical order. Those were attached to a random number. He would then write down the numbers corresponding to his message. The receiver would have the same book, just reversed. He would have all numbers listed from the smallest to the biggest, and he would be able to decode the message by finding the corresponding word/phrase for each number.

So far so good. Now, I keep reading about how Germans would add a layer of enciphering to enhance the security level. I just do not get how this wouldn't be paradoxical with the concept of the codebook. I have 2 different outcome suggestions and they both fall short:

1. Suppose the sender wanted to send the word "hi". He would then encipher this and get, lets say, "xt". He would then look at his codebook and find that there is no number corresponding to "xt".

2. Suppose the sender wanted to send the word "hi". He would then find the corresponding number for "hi". He would then decipher that number and get a different number. The receiver would then look up the number and find either a non-existing number or a wrong word.

Here are two examples in the literature of the history of cryptography that state how an extra layer was added:

"The Zimmermann Telegram was superenciphered (encoded again by using the German Diplomatic Code Book, Code No. 13040)."

Under "VB codebook" in the Wiki page about Room 40:

"Re-ciphering of the code was accomplished using a key made up of a codeword transmitted as part of the message and its date written in German. These were written down in order and then the letters in this key were each numbered according to their order of appearance in the alphabet. This now produced a set of numbered columns in an apparently random order. The coded message would be written out below these boxes starting top left and continuing down the page once a row was filled. The final message was produced by taking the column numbered '1' and reading off its contents downward, then adding on the second column's digits, and so on."

The concept is called superencipherment or multiple encryption, and works as follows:

1. The original message M is enciphered using the code book, resulting in an enciphered message C1.
2. C1 is then treated as the plaintext, and enciphered using another method, resulting in a new ciphertext C2.
3. C2 is then sent to the receiver
4. The receiver uses the decryption algorithm for the second method on C2, obtaining C1.
5. The receiver then uses the code book to decrypt C1 and get the message M.

Creating an example: Suppose I want to send the message "Small supplies of fruit expected. Buy as much as you can." For my code book, I will use the A B C Universal Commercial Electric Telegraphic Code, 4th Edition.

Step 1: On page 128, we have the phrase "Small supplies of fruit expected.", with the corresponding code number 06375. Moving to page 45, we find "Buy as much as you can." with the code number 02221. So in this example, C1 is "06375 02221".

Step 2: For the second level of encryption, I will add 13348 to each code number (ignoring any carry or borrow beyond 5 digits). So to encrypt C1, we calculate 06375+13348=19723 and 02221+13348=15569, resulting in C2 as "19723 15569".

Step 3: The message C2 ("19723 15569") is sent to the receiver.

Step 4: The receiver decrypts C2 by subtracting 13348 from each code number. So the receiver would calculate 19723-13348=06375 and 15569-13348=02221. This results in the message C1 equal to "06375 02221".

Step 5: The receiver then uses the code book to decrypt "06375 02221". Since I am using a one-part code here, again go to pages 128 and 45 to get the original message "Small supplies of fruit expected. Buy as much as you can."

As long as you maintain the sequence "Encrypt using A, Encrypt using B, send, Decrypt using B, Decrypt using A", the exact encryption steps can be replaced as long as the sender and receiver agree on the algorithms and keys.

• Thank you very much, sir. This is exactly the answer I was looking for. I was getting too focused on alphabetical encryption, so I forgot that numbers are equally valid to encrypt. But how do you explain that "The Zimmermann Telegram was superenciphered (encoded again by using the German Diplomatic Code Book, Code No. 13040)". I understand you can encode something and then add an extra layer of encipherment - but how do you encode something twice? – Kristian Francisco Milla Niels Mar 3 '20 at 8:48
• It was encoded in 0075 for transmission to the German embassy in DC, decoded there (to the original message), then encoded in 13040 for transmission to Mexico - So we have Encode A, Decode A, Encode B, Decode B – Eugene Styer Mar 3 '20 at 16:14

Anyone could be confused by this, especially in the case of the Zimmermann telegram.

Codebooks come in three flavors: one-part, two-part, and hybrid. You described a one-part codebook. These are somewhat vulnerable to guessing because they are alphabetical for both plaintext and ciphertext. For example, using English, if you know that 22667 stands for Vienna, then 24556 must be something that starts with W, X, Y, or Z. Two-part codebooks have, according to Merriam-Webster, “an encoding part listing the plaintext segments in alphabetical and logical order each with its code group or groups assigned at random and a decoding part listing in alphabetical or numerical order the code groups with their plaintext equivalents.” They are less vulnerable to guessing.

Since the one-part codebooks were somewhat vulnerable to cryptanalysis, super-encryption was often employed.

In World War 1, diplomatic and field army communications were often super-encrypted at the time of transmission with a substitution table or an additive-- which usually did very little good, especially for the Germans.

On page 252 of the 1967 edition (Macmillan Company) of The Codebreakers, David Kahn goes into detail about how super-encryption was done:

“...super-encipherment was a form of substitution; the 'alphabet' was an ordinary scale of numbers. This method added a keynumber, called an 'additive,' to the original codenumber, called the 'plain code' or 'placode.' The sum constituted the final cryptogram...”

During World War 1, the German embassy in Washington D.C. received what would be called the Zimmermann telegram, which had been encoded with German diplomatic code 0075. Relatively new, this codebook had been in use since mid-1916. [1] They forwarded the telegram to the German legation in Mexico City by simply re-encoding the plaintext they had just resolved from code 0075. The problem would be that they chose an old German diplomatic code, 13040, to re-encode the telegram—just as the British thought they would (Dooley, p. 92). 13040 had been around since 1907. [2] Over the years, the British had broken 13040, which was a one-part/two-part hybrid, the old-fashioned way: painstaking effort. [3]

The Germans in Mexico City did not have 0075, but they did have the much weaker 13040. In short, a decoded ciphertext was re-encoded with another codebook, one that had been broken. Mysteriously, there was no super-encryption—not that this would have helped because using additives prior to transmission did not tend to slow down the British, and in this case, the Brits already had enough plaintext to understand the message, especially the part about unrestricted submarine warfare against the United States. [4] Barbara Tuchman, in her book about the Zimmermann telegram, writes:

"Generally, although not always, when the Germans used code they wrapped it inside an extra covering of cipher; that is, they enciphered the code. The key to the encipherment they changed frequently—as time went on, every twenty-four hours. But, being orderly Germans, they changed it according to an orderly system which, once solved by the cryptanalysis of Room 40, could be solved again each time by progressing according to a constant pattern. For some reason still obscure, the Zimmermann telegram, when it was sent, was not put in enciphered code." [5][6]

At the time the message was sent from Berlin—16 January, 1917--the British had only partially broken 0075. But they had been very hard at work. They later came up with a romantic story--about a suitcase from Iran containing Code Book 13040 showing up in England [7]—to cover their collection and cryptanalysis efforts, both of which were intense. They had in fact been spying on American diplomatic cables, sent over copper wire, thanks to their relay station in Cornwall, where they intercepted the Zimmerman Telegram and broke enough of it to learn its meaning. The Germans had actually sent their cable from the U.S. embassy in Berlin for forwarding.

The British then bribed one of the staff at the relevant telegraphy station in Mexico to get a copy of the 13040-encrypted ciphertext that Western Union had received. After that they invented a cover story to hide their cable-telegraphy collection against the United States, and conceal their significant cryptanalysis capabilities, they lied and said that they had stolen the deciphered telegram in Mexico.

David Kahn also goes into detail about how super-encryption was done over Morse telegraphy prior to, and throughout, World War 1. He also mentions how German super-encryption was first solved by the Allies, on 13 October, 1914, by Charles Rotter. [8] Super-encryption ended up being relatively unimportant because it tended to be weak, but cryptanalysis made a name for itself.

John F. Dooley wrote a book dedicated to World War 1 cryptography: Codes, Ciphers, and Spies: Tales of Military Intelligence in World War 1. He talks about how the Germans shifted from ciphers to codes in early 1917, and how the Geheimklappe enciphering and deciphering tables were used to super-encrypt codebook traffic. On page 66 he goes into detail about how it was done in the early part of 1918. They would substitute the first two digits of each three-digit plaintext word by using the Geheimklappe.

Traffic looked like this:

AN v X2 (Souilly 0040) 0025 CHI-13
845 422 373 792 240 245 068 652 781 etc.  (Dooley 2016, p.66)


Concerning World War I, we should distinguish between German diplomatic traffic and that of the field armies. The ADFGX and ADFGVX ciphers were used on the ground, also transmitted in Morse, but over crystal set radio and not superencrypted. Both sides used Low Wave and Medium Wave bands for their radio telegraphy because, prior to 1920, frequencies over 2 MHz were though to be useless. [9]

ADFGX came out on 5 March, 1918, close to the end of the war; it was later to become ADFGVX, on 1 June, 1918. [10] Interestingly, the French broke ADFGVX in 26 hours. (Kahn 1967, pp. 344-345). Both used a Polybius Square with a mixed alphabet for fractionation (biliteral), followed by a single columnar transposition—no superencryption. But other encryption systems for radio such as the American Trench Code used codewords that were designed to be superenciphered – using substitution (Dooley 2018, p. 97).

[1] Dooley, John F. 2018. History of Cryptography and Cryptanalysis, p. 90.

[2] Gathen, Joachim von zur. 2007. Zimmermann telegram: the original draft. Cryptologia 31 (1): 2–37. https://doi.org/10.1080/01611190600921165

[3] Boghardt, Thomas. 2012. The Zimmermann Telegram: Intelligence, Diplomacy, and America’s Entry into World War I. Annapolis: Naval Institute Press. p.84. Interestingly, he disagrees with Kahn about the superencipherment of the telegram. See p. 253.

[4] John Dooley says, “The British had worked out most of the code groups in 13040, to the point that they could easily remove the superencipherment and decode any German messages in the older code...”, p. 90.

[5] Tuchman, Barbara. 2014. The Zimmerman Telegram. Chapter 1. This book is a tremendously good read.

[6] David Kahn says that the 0075 message was probably superenciphered, but the 13040 message was not. Kahn, David. 1967. The Codebreakers. p. 293.

[7] Their cover stories lasted for decades, and this is one source of the confusion about the Zimmermann Telegram. See Freeman, Peter. 2006. The Zimmermann Telegram revisited: a reconciliation of the primary sources, in Cryptologia 30 (2): 98–150.

[8] Kahn, David. 1967. The Codebreakers. p. 268.

[9] Oleg Golovin, Aguilar Hardon, Nikolai Chistyakov, Wolfgang Schwarz. Radio communications. Moscow. 2012. Hotline – Telecom, p. 25-40.

[10] Dooley, John F. 2016. Springer. Codes, Ciphers, and Spies: Tales of Military Intelligence in World War 1. pp. 83,87.

• This is much helpful. Thanks for being so thorough. In the qoute is "AN v X2 (Souilly 0040) 0025 CHI-13" also a part of the code? – Kristian Francisco Milla Niels Mar 6 '20 at 14:51
• @KristianFranciscoMillaNiels Welcome! No, that is the addressing information. AN to X2... and perhaps the date/time group... The code is comprised of the three-letter groups. – Patriot Mar 6 '20 at 14:54
• @KristianFranciscoMillaNiels You may want to upvote an answer. – Patriot Mar 7 '20 at 16:45