1001Ferramentas
🔡 Security

Monoalphabetic Substitution Cipher

Encrypt/decrypt with a custom A-Z substitution key and show letter frequencies for didactic analysis.

Monoalphabetic substitution with the full permutation

This is the general form of which Caesar, Atbash and the keyword cipher are special cases: you declare where each of the 26 letters goes, with no restriction. The key space is 26 factorial, a number with 27 digits — if each key took a microsecond, trying them all would take longer than the age of the universe.

Enter the full permutation, 26 letters with no repeats, and the text. The page validates the key before anything else: fewer than 26 letters, a missing letter or a repeated one are refused with the reason, because an invalid permutation would produce a cipher with no way back. The reverse direction deciphers using the mapping read backwards.

The size of the key space does not make it secure, and that is the cipher's most useful lesson. Brute force is impractical, but nobody needs it: letter frequency survives intact, and with a paragraph a cryptanalyst identifies the commonest letters, deduces the digrams and fills the rest in by word pattern. It is the classic example that a large key does not imply security.

Frequently asked questions

If there are that many keys, why is the cipher weak?
Because the attack is not brute force. Each plaintext letter always becomes the same ciphertext letter, so the language's statistics pass wholesale into the ciphertext. Counting frequencies, looking at one-letter words and hunting common digrams solves a paragraph in minutes, and programs exist that do it automatically.
How do I build a good permutation?
By shuffling properly, with a random draw, rather than writing one by hand — a hand-made key tends to keep letters near their original positions, which helps the attack. It is worth checking that no letter maps to itself, though that changes little in practice.
Is this the same as a newspaper cryptogram?
It is exactly that. The cryptogram puzzle is a monoalphabetic substitution the reader solves by frequency and word pattern — the same technique that breaks the cipher. Which makes it excellent for teaching cryptanalysis and useless for protecting information.

Related Tools