ADFGVX Cipher

In cryptography, the ADFGVX cipher was a field cipher used by the German Army during World War I. ADFGVX was in fact an extension of an earlier cipher called the ADFGX cipher. Invented by Colonel Fritz Nebel and introduced in March 1918, the cipher was a fractionating transposition cipher which combined a modified Polybius square with a single columnar transposition. The cipher is named after the six possible letters used in the ciphertext: A, D, F, G, V and X. These letters were chosen deliberately because they sound very different from each other when transmitted via morse code. The intention was to reduce the possibility of operator error.[1]

From Kahn's 'The CodeBreakers':

"It was no less clear to the Allies that Germany planned to launch a climactic offensive in the spring. There were many signs—the new cipher itself was one. The question was: Where and when would the actual blow fall? The German high command, recognizing the incalculable military value of surprise, shrouded its plans in the tightest secrecy. Artillery was brought up in concealment; feints were flung out here and there along the entire front to keep the Allies off balance; the ADFGVX cipher, which had reportedly been chosen from among many candidates by a conference of German cipher specialists, constituted an element in this overall security, as did the new Schliis-selheft. The Allies bent every effort and tapped every source of information to find out the time and place of the real assault."[2]

Georges Painvin was the French cryptanalyst tasked with cracking the ADFGVX cipher. The intelligence he provided was vital to the French war effort, particularly in saving Paris in 1918:

"At midnight on June 9 the front from Montdidier to Compiegne erupted in a fierce, pelting hurricane of high-explosive, shrapnel, and gas shells. For three hours a German artillery concentration that averaged one gun for no more than ten yards of front poured a continual stream of fire onto the French positions—and Ludendorff's urgent demand for ammunition became clear. But this time, for the first time since Ludendorff began his stupendous series of triumphs, there was no surprise. Painvin's manna had saved the French."[2]

The Algorithm §

The 'key' for a ADFGVX cipher is a 'key square' and a key word. e.g.

p h 0 q g 6 4 m e a 1 y l 2 n o f d x k r 3 c v s 5 z w 7 b j 9 u t i 8

The key square is a 6 by 6 square containing all the letters and the numbers 0 - 9. The key word is any word e.g. GERMAN

There are a number of steps involved:

Build a table like the following with the key square. This is known as a polybius square. A D F G V X A | p h 0 q g 6 D | 4 m e a 1 y F | l 2 n o f d G | x k r 3 c v V | s 5 z w 7 b X | j 9 u t i 8 Encode the plaintext using this matrix, to encode the laetter 'a', locate it in the matrix and read off the letter on the far left side on the same row, followed by the letter at the top in the same column. In this way each plaintext letter is replaced by two cipher text letters. E.g. 'attack' -> 'DG XG XG DG GV GD'. The ciphertext is now twice as long as the original plaintext. Note that so far, it is just a simple substitution cipher, and trivial to break. Write the code word with the enciphered plaintext underneath e.g. G E R M A N D G X G X G D G G V G D Perform a columnar transposition. Sort the code word alphabetically, moving the columns as you go. Note that the letter pairs that make up each letter get split apart during this step, this is called fractionating. A E G M N R X G D G G X G G D V D G Read the final ciphertext off in columns. -> XG GG DD GV GD XG

A Short Example §

We will now encipher:

DEFEND THE EAST WALL OF THE CASTLE

Using the same key as above, after the substitution step we get:

FXDFFVDFFFFXXGADDFDFDGVAXGVGDGFAFAFGFVXGADDFGVDGVAXGFADF

We now write this out with the keyword above (table on the left), and sort the columns (table on the right):

G E R M A N F X D F F V D F F F F X X G A D D F D F D G V A X G V G D G F A F A F G F V X G A D D F G V D G V A X G F A D F A E G M N R F X F F V D F F D F X F D G X D F A V F D G A D D G X G G V F A F A G F A V F G D X D F D V G G F A V G A X F D

We now read off the columns to get the final cipher:

FFDVDFADFXFGFGAVFAFFDXDXFFDVDFFDGGAGVGVXFAGGDGADFADVFXGX

Javascript Implementation §

The keysquare in this example has been written on a single line. To convert to the square shape, simply write the first 6 characters on the first line, the second six characters on the second line etc.

attack

Plaintext

keysquare =

keyword =

Ciphertext



Other Implementations §

To encipher your own messages in python, you can use the pycipher module. To install it, use pip install pycipher . To encipher messages with the ADFGVX cipher (or another cipher, see here for documentation):

>>>from pycipher import ADFGVX >>>a = ADFGVX('ph0qg64mea1yl2nofdxkr3cvs5zw7bj9uti8','HELLO') >>>a.encipher('defend the east wall of the castle') 'XDXDGVAFDDGFVFDDGFGAVXFDFXFVGFVDGFFFGDADAXFVAFFAFXGFGGAD' >>>a.decipher(_) 'DEFENDTHEEASTWALLOFTHECASTLE'

For the ADFGX cipher:

>>>from pycipher import ADFGX >>>a = ADFGX('phqgmeaylnofdxkrcvszwbuti','HELLO') >>>a.encipher('defend the east wall of the castle') 'FDFDDXGFDDGFDFDDGDAADXADAXAGADDDDDADGDGDGXAGGFXAAXDFGGGD' >>>a.decipher(_) 'DEFENDTHEEASTWALLOFTHECASTLE'

The cipher presents several difficulties to the cryptanalyst. Ordinarily when breaking columnar transposition ciphers, anagramming is used to determine the key. Once the substitution step is introduced, however, this approach becomes impossible. The letter frequencies are also modified due to the fractionating nature of the cipher, which adds further difficulties.

The French cryptanalyst Painvin, who first broke the ADVGVX cipher, only managed to break it in specific circumstances. The exact circumstances he needed only occurred on days with very heavy traffic. His techniques are described in Friedman's book 'Military Cryptanalysis - Part IV', along with several other more general techniques.

Cryptanalysis of the ADFGVX cipher is also discussed in a paper called "Cryptanalysis of ADFGVX encipherment systems" in Proceedings of CRYPTO 84 on Advances in cryptology. Unfotunately this paper is not available to the public, however an extended abstract is available.

[1] Wikipedia has a good description of the encryption/decryption process, history and cryptanalysis of this algorithm

[2] Kahn, D (1973) The CodeBreakers . Macmillan: New York

. Macmillan: New York Simon Singh's 'The Code Book' is an excellent introduction to ciphers and codes, and includes a section on ADFGVX ciphers. Singh, Simon (2000). The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography . ISBN 0-385-49532-3.

Please enable JavaScript to view the comments powered by Disqus.

Disqus