Ciphers

ADFGVX

The 1918 German field cipher. A 6×6 grid writes each letter or digit as two of A D F G V X, then a second key shuffles the columns.
IDadfgvx35 / 72classical · fractionation
Cipher / Fractionation

ADFGVX

A 6×6 grid of letters and digits.

Keyspace
36! grids × n! column orders
Decode
same options back
Works on
A-Z and 0-9, the rest dropped
Family
10 in fractionation
required 0 / 2

Options

keystring
optional
Optional keyword for the 6×6 grid
transpositionstring
optional
Keyword for the columnar transposition step; empty skips it

Access

Createcreate("adfgvx")
CLIciphers encode adfgvx 'ATTACK AT 1200'
Tryplayground with the sample above
Kinpolybius, nihilist, morse, fractionated-morse +5

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. The grid holds A to Z and 0 to 9, key reorders it with the keyword first, duplicates removed. transposition is the second key: the pairs are written in rows under it and read out column by column in its alphabetical order, the same rule as columnar. Anything that isn't a letter or a digit is dropped.

ts
const adfgvx = create("adfgvx");
const keys = { key: "147 regiment", transposition: "privacy" };
adfgvx.encode("attack at 1200am", keys).text; // "DXXVGDADDAAXDVDXVFGVGFADDVVD"
adfgvx.decode("DXXV GDAD DAAX DVDX VFGV GFAD DVVD", keys).text; // "ATTACKAT1200AM"
adfgvx.encode("ATTACK AT 1200").text; // "AAGDGDAAAFDVAAGDVGVVVFVF"
adfgvx.decode("AAGDG"); // CipherError: Invalid ADFGVX code: 5 letters A, D, F, G, V and X, not whole pairs

Leave transposition out and you get the grid step alone, which is half a cipher: fine for a puzzle that only uses the grid, useless against a real 1918 message. Decoding drops everything but the six letters before undoing the columns, so the five-letter groups of a telegram go in as printed. Every letter or digit is a pair, so an odd count means one went missing on the way. Decoding says so instead of handing back a shorter message. Text with none of the six letters is an error too, not an empty answer.