ADFGVX


The ADFGVX Cipher is another cipher that has its central encryption element as a table, and manipulates that table as its enciphering mechanism. One of its specialties is that it is one of few ciphers that allows for numbers to also be enciphered. It was an extension of a previous cipher called ADFGX that could only encode letters in the alphabet. With the extra V, we can now encode all letters and the numbers from 0-9. It was the central cipher of the German Army during World War I. Howvever, it was broken very shortly after its introduction into the German military. The cipher is called the ADFGVX due to the letters that the cipher eventually encrypts into. These letters are special since they are not similar to each other when transmitted through Morse code, and thus had a lower chance of having a message relayed improperly.


Encoding ADFGVX

Encoding ADFGVX begins with the creation of a randomized 6x6 keygrid. This keygrid should include every letter plus the numbers from 0-9. Since there are 26 letters and 10 digits, it should perfectly fit the 36 spaces. For our example, we will be using the keygrid on the ADFGVX table to the right.

Begin the enciphering process by finding the first letter of the ciphertext in the 6x6 keygrid. Then, take the letters of its row and then column. Repeat this step for all letters and numbers in the cipher. Every letter or number should now be represented by row-column pairs.

Plaintext:    CHARGE AT 0600
Letter Pairs: FA AF FD XD DV DA FD DG FX GA FX FX

Once that has been accomplished, we can now use our keyword. For our example, the keyword will be "VERDUN". Each of the letters in the keyword will become a special "column". Write the letters in a horizontal fashion (left-to-right) underneath the keyword, wrapping around once you reach the end of it. For simplicity, it may be easier to find keys that are a divisor of the length of the message; however, it does not matter if some columns are shorter than others.

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

Now, while this seems rather complicated already, realize that what we've accomplished so far is only a simple subsitution cipher. With a long enough text, frequency analysis is all that is required to break it. Therefore, we do a special transposition of the keyword columns. We arrange them alphabetically, taking the columns of the row-column pairs with us.

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

From here, the ciphertext is simply the leftover columns, not rows, of the completed transposition.

Ciphertext: FVGX ADDA DAXX ADDF FDFF FXFG

Decoding ADFGVX

Decoding ADFGVX when you know the keyword is simply a matter of rearranging the columns and then switching the column-row pairs back into their letters using the 6x6 keygrid. If the ciphertext is not divided into its columns, take the length of the ciphertext, divide that by the length of the keyword, and then divide the ciphertext into that amount of equal sized groups.

Breaking ADFGVX

ADFGVX was broken rather quickly after its introduction late into World War I by the German military, it was broken by Lieutenant Georges Painvin in 1918. Painvin based his method of decoding based off rather intuitive knowledge of German encryption and a modified form of frequency analysis. Painvin figured out that during periods of high traffic, plenty of source material would come about that Painvin could analyze for repeated phrases or patterns. Since a day's messages in the trenches were likely encoded using the same keygrid and perhaps even the same keyword due to lax standards, Painvin knew that common phrases, such as "French" or "trench" would be encoded in the exact same way. This was his central method of breaking the ADFGVX cipher. He also used a quirk about how ADFGVX enciphers its text to derive how long a possible keyword may be.

ADFGVX Table

    A D F G V X
A Z 8 H V 7 X D E Q L T G P F C A O W S 0 G 6 K 4 M J I V 1 Y 2 F N B X U R D 5 9 3

ADFGVX Example

Plaintext:  CRYPTOLOGY IS COOL
Key: CODE
Ciphertext: FVDDDGFF XDFFVFFD DXFFDVFF ADGFVXAF

Practice with ADFGVX

Every example makes use of the example keygrid.
Example 1: Encipher THE ATTACK BEGINS AT DAWN using the keyword "TRENCH" Example 2: Encipher IN 1492 COLUMBUS SAILED THE OCEAN BLUE using the keyword "BOAT" Example 3: Decipher GDFVVFVFAXFDFFVXGADXAAXGXGFGAXDGFXXXDAXXAXDFFGVDXAAXVFXAGGXXDGVFGDDDAAXGFDVGXXAADFDFFDFAXADDGVGDFVDA using the keyword "TELEVISION" Example 4: Decipher XVXFFGAFAFAXAGVAFGGFDFFDFFDAFVFGFDDDDXDVXFAFFGADFDXFGVGAGDAFFVGXFAFADDXD using the keyword "GEMS" Paragraph: Decipher this paragraph with the keyword "YPRES":

VFFFXXGDXDXFADVDDFVFVFFGDXXFDG
GFDDDFGDDDDVXVDFADDGFDAVFAXDVXG
DVDFGVFXFAAAFAFFFGDDFDFAXVDDAF
GVDXAFGVDFFDADFXAVFAFVFXDGFDAD
XVFDGVFXVFFVFAGXFDDFFDAVFFDDFX
GVXGVVAFFXDXFXVDGVDDVDFAXDADGD
ADAFVXGXGFGGADAVXAVDAXVGFFAFVV
GFDDAXGDAVXFXGGVAVAFFFXFFVGDGF
FDDFDDDFDXFDVVFGGDDFXVDDVDVDVX
AFFGGDVDF

Example 1: DDGDFXVAADFDVDFAAGDVVFVXFGAAVGGXGDDXXDDXDFFVGFFA
Example 2: VGVFXVFFDXAFDVDDGVXFDGXFGDDDFFVXXAVAFGAVXAGAADXAVFFFAXVDFFFFAVFA
Example 3: THERE ARE MILLIONS OF POSSIBILITIES FOR THE FUTURE
Example 4: ITS UP TO YOU TO CHOSE WHICH BECOMES REALITY
Paragraph: IN FLANDERS FIELDS THE POPPIES BLOW
BETWEEN THE CROSSES ROW ON ROW
THAT MARK OUR PLACE AND IN THE SKY
THE LARKS STILL BRAVELY SINGING FLY
SCARCE HEARD AMID THE GUNS BELOW
- In Flanders Fields, a poem by John McCrae

Python Application of ADFGVX

This application to come soon