Transform any message into a sequence of chess moves using HMAC-keyed steganography. The encrypted game looks indistinguishable from a real chess match.
Encrypt a message or decode a .cpgn file
Paste a PGN and key to decrypt
The mathematics behind the cipher
With n legal moves at a position, we can hide k = βlogβ(n)β bits per move. We only use the first 2α΅ moves so the bit-to-index mapping is a clean bijection.
For a board position FEN and move m, compute HMAC-SHA256(key, FENβm). Sorting by this value creates a position-specific, key-dependent permutation of moves.
If a game reaches a position with fewer than 2 legal moves (checkmate, stalemate, or only 1 option) before all bits are encoded, a new game automatically starts from the initial position.
The first 32 bits encode the message byte-length as a big-endian unsigned integer. During decryption, this tells the decoder exactly how many bits to extract β preventing padding artifacts.