Ciphers

Polybius square

Each letter becomes a row digit and a column digit in a 5×5 grid, I and J sharing a cell. An optional keyword reorders the grid.
create
create("polybius")
family
Fractionation
options
--key?
self-inverse
no
keyspace
1 (standard) or 25! (keyed)
try it
ciphers polybius "HELLO"

The alphabet fills a 5×5 grid, J folded into I. A letter is its row and column, both 1 to 5, pairs separated by spaces. With a key the keyword goes first, duplicates removed, and the rest of the alphabet follows - the same square Playfair and Bifid build.

const polybius = create("polybius");
polybius.encode("HELLO").text; // "23 15 31 31 34"
polybius.encode("JULIUS").text; // "24 45 31 24 45 43", J is 24 like I
polybius.encode("HELLO", { key: "KEYWORD" }).text; // "33 12 35 35 15"
polybius.decode("23 15 31 31 34").text; // "HELLO"

Decoding reads digit pairs and leaves anything else in place, so "23 ab 24" becomes "HabI". Tap code is the same grid with C and K sharing instead of I and J. Bifid and ADFGVX build on the coordinates.

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