Ciphers

ADFGVX

A 6×6 grid of letters and digits, each character written as two of A D F G V X. The fractionation half of the 1918 field cipher.
create
create("adfgvx")
family
Fractionation
options
--key?
self-inverse
no
keyspace
36! (full grid) or keyed subset
try it
ciphers adfgvx "ATTACK AT 1200"

The German field cipher of 1918 had two steps. First a 6×6 substitution that turns every letter or digit into a pair from ADFGVX, six letters picked because they sound nothing alike in Morse. Then a columnar transposition with a second key. This implementation is the first step only. The grid holds A to Z and 0 to 9, key reorders it with the keyword first, duplicates removed. Anything that is not a letter or a digit is dropped.

const adfgvx = create("adfgvx");
adfgvx.encode("ATTACK AT 1200").text; // "AAGDGDAAAFDVAAGDVGVVVFVF"
adfgvx.encode("ATTACK AT 1200", { key: "PRIVACY" }).text; // "AVGGGGAVAXFFAVGGVGVVVFVF"
adfgvx.decode("AAGDGDAAAFDVAAGDVGVVVFVF").text; // "ATTACKAT1200"

Want the full cipher? Pipe the output through columnar with the transposition key. Reverse the order to decode.

@agntn/ciphers·MIT license· Classical ciphers, for lessons and puzzles. Not for protecting anything, ever.