ADFGVX and ADFGX Cipher

Plaintext
Ciphertext
ADFGVX
AABCDEF
DGHIJKL
FMNOPQR
GSTUVWX
VYZ0123
X456789

What is the ADFGVX Cipher?

The ADFGVX cipher is a polyalphabetic substitution cipher that was originally used by the German military during World War I. It combines both substitution and transposition principles and utilizes a 6×6 matrix to encrypt letters. In this cipher, letters are replaced by a pair of characters that correspond to the rows and columns of the matrix. The name "ADFGVX" comes from the six letters used in the matrix (A, D, F, G, V, X), which represent the rows and columns, as shown below:

ADFGVX

In the ADFGVX cipher, each plaintext letter is first replaced with a pair of letters that represent the row and column positions, based on a predefined alphabet. For example, the letter "M" corresponds to the row-column code "FA". The second step in encryption is to rearrange these letter pairs according to a keyword, resulting in the final ciphertext.

Comparison between ADFGVX and ADFGX Ciphers

While both ADFGVX and ADFGX belong to the same cipher family, there are key differences between the two. These differences mainly lie in the structure of the alphabet and the number of characters used, which in turn affect the complexity of encryption and decryption as well as the suitability for different use cases.

FeatureADFGVXADFGX
Alphabet Size6×6 matrix, 36 characters (letters + numbers)5×5 matrix, 25 characters (letters only)
Row/Column CodeA, D, F, G, V, XA, D, F, G, X
Encryption ComplexityHigher, supports more types of characters, stronger securityLower, handles only letters, simpler encryption
SecurityStronger, suitable for high-security needsWeaker, suited for simpler encryption
Use CasesUsed for complex information encryption, such as military communicationsUsed for simpler, letter-only encryption

How Does the ADFGVX and ADFGX Cipher Encrypt?

  1. Prepare the Plaintext: Remove any non-alphabet characters (such as spaces, punctuation, etc.).
  2. Construct the Alphabet Matrix: Set up the alphabet, creating the ADFGVX or ADFGX matrix based on the chosen alphabet.
  3. Substitute Plaintext Characters: For each letter in the plaintext, locate its corresponding row and column in the matrix and replace it with a pair of letters representing its position.
  4. Construct the Key Table: Using the keyword, construct a table by writing the row-column codes into it, filling in the rows.
  5. Sort the Table: Reorganize the columns based on the alphabetical order of the keyword letters.
  6. Generate the Ciphertext: Read the table column by column to obtain the final ciphertext.

Example

Assume the plaintext is: "HELLO WORLD", using the default alphabet (A-Z, 0-9) in ADFGVX mode, and the keyword "KEYWORD":

1. Construct the Alphabet Matrix

ADFGVX
AABCDEF
DGHIJKL
FMNOPQR
GSTUVWX
VYZ0123
X456789

2. Substitute Plaintext Characters

3. Build and Fill the Key Table

KEYWORD
3276451
DDAVDXD
XFFGVFF
FXDXAG

4. Sort the Table

DEKORWY
1234567
DDDDXVA
FFXVFGF
XFAGXD

5. Generate the Ciphertext

Read column by column to obtain the final ciphertext: DFDFXDXFDVAXFGVGXAFD.

How Does the ADFGVX Cipher Decrypt?

The decryption process mirrors the encryption steps. After obtaining the row-column coordinates, you need to fill them into a table according to the alphabetical order of the keyword (A-Z). Pay attention to whether the table can be completely filled. If not, note which cells are left empty. Once filled, restore the table to the original order of the keyword. Finally, read across the rows (horizontally) in pairs to retrieve the row-column coordinates. Using these coordinates and the alphabet matrix, the original plaintext is restored.

Share This Page