The Black Chamber RU

Tools · Classical ciphers

Polybius square and tap code

The Polybius square: letters to digit pairs and back, the prisoners’ tap code and ADFGX.

Runs in your browser. Your text goes nowhere.

How to use it

Pick a mode: the Polybius square, the tap code or ADFGX. Type a text and the result appears at once. To read a code, switch to “Decode” or press “⇅”, which swaps the boxes.

In square mode every letter becomes a pair of digits: its row and its column. The Latin square is 5×5, with I and J sharing a cell; the Russian one is 6×6, holding 33 letters and three marks (full stop, comma, hyphen). “Help” becomes 23 15 31 35. The cells your text passes through light up in the square, and clicking a cell adds its letter, so you can type the code with the mouse.

The tap code

The same square, but the digits are knocks: as many taps as the row number, a short pause, then the column. The Latin version drops K, which is tapped as C, and gives J a cell of its own. American prisoners of war in Vietnam used it to talk through cell walls; it is easy to learn and needs nothing but a wall. “Knock it” plays the result as sound.

ADFGX

In March 1918 the German army switched to the ADFGX cipher. It takes a 5×5 square mixed by a keyword and labels the rows and columns with A, D, F, G and X, letters that are hard to confuse in Morse code. Each letter becomes a pair of those letters, and then the whole string goes through a columnar transposition with a second key. Substitution plus transposition was strong for its day. That summer a 6×6 version, ADFGVX, added the digits. The French cryptanalyst Georges Painvin broke it all the same. Enter both keys and the tool shows both stages.

Questions

Who was Polybius?

A Greek historian of the second century BC. He described sending letters with torches, by the number of fires raised on the left and on the right. The square of letters is his idea.

Is the Polybius square secure?

Not on its own. It is a simple substitution with the letters written as digits, and the frequencies of the pairs give it away just as letter frequencies do. See the lesson on substitution and the lesson on transposition.

Is my text sent anywhere?

No, everything runs in your browser.