ADFGX Cipher
by fortenforge, Jan 23, 2010, 4:31 AM
During WWI, the Germans used this cipher frequently. It worked like this:
_ A D F G X
A t h e q u
D i c k b r
F o w n f x
G m p s v a
X l z y d g
We create a 5 by 5 matrix like we did with the playfair cipher, again, we omit the letter J, when encrypting your ciphertext convert all J's to I's. As you may have guessed, every letter has a digraph mapped to it, for example, the letter "s" is equal to "GF" because it is on row G and column F. The letters A, D, F, G, and X were chosen because they sound very different when they were written in Morse Code so that there would be no errors in transmission if the ciphertext was transmitted via a telegraph. We also have to choose another keyword, for this example we will choose the word "LAZY".
Here is our plaintext:
"seven oceans on the planet earth".
We first remove all spaces:
"sevenoceansontheplanetearth"
then, we convert each letter into it's corresponding digraph.
"GF AF GG AF FF FA DD AF GX FF GF FA FF AA AD AF GD XA GX FF AF AA AF GX DX AA AD"
Now we remove spaces again:
"GFAFGGAFFFFADDAFGXFFGFFAFFAAADAFGDXAGXFFAFAAAFGXDXAAAD"
Forget about this for a sec and go back to our second keyword "LAZY", write it down:
L A Z Y
Now put the string I told you to forget about under the 4 letters wrapping about like this:
L A Z Y
G F A F
G G A F
F F F A
D D A F
G X F F
G F F A
F F A A
A D A F
G D X A
G X F F
A F A A
A F G X
D X A A
A D F D
I filled the remaining two spaces next to the last 2 characters with two "null" characters that mean nothing.
Next, alphabetize the 2nd keyword: LAZY --> ALYZ. When you move the letters of the keyword around to alphabetize it, also move the columns under the letter around so that the column under the A is still under the A after the alphabetization and the column under the L is still under the L after the alphabetization and so on:
A L Y Z
f g f a
g g f a
f f a f
d d f a
x g f f
f g a f
f f a a
d a f a
d g a x
x g f f
f a a a
f a x g
x d a a
d a d f
Then you read out the resulting letters by row: fgfaggfaffafddfaxgfffgafffaadafadgaxxgfffaaafaxgxdaadadf.
This is your ciphertext, to decrypt reverse the process and ignore any letters at the end that do not make sense, these letters are from the null characters you added.
To recognize that a cipher is an ADFGX cipher, if the ciphertext has only the letters A, D, F, G, and X, then it is probably an ADFGX cipher.
_ A D F G X
A t h e q u
D i c k b r
F o w n f x
G m p s v a
X l z y d g
We create a 5 by 5 matrix like we did with the playfair cipher, again, we omit the letter J, when encrypting your ciphertext convert all J's to I's. As you may have guessed, every letter has a digraph mapped to it, for example, the letter "s" is equal to "GF" because it is on row G and column F. The letters A, D, F, G, and X were chosen because they sound very different when they were written in Morse Code so that there would be no errors in transmission if the ciphertext was transmitted via a telegraph. We also have to choose another keyword, for this example we will choose the word "LAZY".
Here is our plaintext:
"seven oceans on the planet earth".
We first remove all spaces:
"sevenoceansontheplanetearth"
then, we convert each letter into it's corresponding digraph.
"GF AF GG AF FF FA DD AF GX FF GF FA FF AA AD AF GD XA GX FF AF AA AF GX DX AA AD"
Now we remove spaces again:
"GFAFGGAFFFFADDAFGXFFGFFAFFAAADAFGDXAGXFFAFAAAFGXDXAAAD"
Forget about this for a sec and go back to our second keyword "LAZY", write it down:
L A Z Y
Now put the string I told you to forget about under the 4 letters wrapping about like this:
L A Z Y
G F A F
G G A F
F F F A
D D A F
G X F F
G F F A
F F A A
A D A F
G D X A
G X F F
A F A A
A F G X
D X A A
A D F D
I filled the remaining two spaces next to the last 2 characters with two "null" characters that mean nothing.
Next, alphabetize the 2nd keyword: LAZY --> ALYZ. When you move the letters of the keyword around to alphabetize it, also move the columns under the letter around so that the column under the A is still under the A after the alphabetization and the column under the L is still under the L after the alphabetization and so on:
A L Y Z
f g f a
g g f a
f f a f
d d f a
x g f f
f g a f
f f a a
d a f a
d g a x
x g f f
f a a a
f a x g
x d a a
d a d f
Then you read out the resulting letters by row: fgfaggfaffafddfaxgfffgafffaadafadgaxxgfffaaafaxgxdaadadf.
This is your ciphertext, to decrypt reverse the process and ignore any letters at the end that do not make sense, these letters are from the null characters you added.
To recognize that a cipher is an ADFGX cipher, if the ciphertext has only the letters A, D, F, G, and X, then it is probably an ADFGX cipher.