The ADFGVX Cipher is a combination of both substitution and transposition. Although it can be broken, it is harder to crack than other ciphers due to its use of transposition. As the name suggests, the ciphertext only uses the 6 letters A,D,F,G,V and X. Although in principle any 6 letters could be used, these were chosen since the cipher was primarily a field cipher used during World War I, and those letters sounded most dissimilar when transmitted via Morse Code, thus reducing the probability of transmission errors.
The key used by this cipher takes the form of a 6x6 grid, with the columns and rows labelled by each of the letters. The grid itself is filled with a random permutation of the 26 alphabetic characters and 10 integers. For example,
A D F G V X ---------------- A | 6 C R I O Y D | 3 2 A T E 1 F | 9 G Q 0 F N G | B L Z K V 4 V | 3 P D 5 M W X | S H 8 U 7 X
The first stage of encryption is to substitute each character by the corresponding labels of its row and column in the key. After this, the ciphertext is no more secure than a simple monoalphabetic substitution cipher.
Next, a number of columns is decided upon, and the ciphertext is written out row by row, with one character (not digraph) per column. The columns are then reordered using some pre-arranged permutation (one possibility is to assign a keyword with length the same as the number of columns, and then arrange the columns alphabetically according to this keyword labelling). Finally, the final ciphertext is given by writing out the columns in order.
Using the key above and the plaintext
ATTACK AT 1800the first stage results in the ciphertext
DF DG DG DF AD GG DF DG DX XF PG PG
Choosing 4 columns, and ordering them "3421", we get:
1 2 3 4 3 4 2 1 ======= ======= D F D G D G F D D G D F D F G D A D G G ==> G G D A D F D G D G F D D X X F X F X D P G P G P G G Pwhich results in the ciphertext (after writing out the characters column by column):
D D G D X P G F G G F G F G D F X G D D A D D P
Breaking the Cipher
The first step in breaking this cipher is to determine the number of columns. It is not necessary to have a number of columns that divides the total number of characters exactly, however where this is the case, the number of columns will be a factor of the number of letters. If this is not the case then this step is considerably harder (but not impossible).
Once possible column numbers have been identified, the cipher should be written back out in columns, and then all possible pairings considered. For each pairing, frequency analysis is performed on the digraphs produced, and compared to the frequency tables for the given language. Those pairings that generate a frequency graph similar to that of the plaintext language are selected as "likely candidates" and from these pairs the total ordering of columns can be guessed.
Once the original order of columns has been deduced, decryption proceeds as per the standard monoalphabetic substitution cipher. Note that overall, this method will require some guesswork and backtracking, in case the number of columns or their permutations is guessed wrongly.