Keyword Substitution Cipher

Build a 26-letter cipher alphabet from a keyword for substitution

Ad placeholder (leaderboard)

A keyword substitution cipher is a classic monoalphabetic cipher in which the ciphertext alphabet is reordered using a memorable keyword. The keyword seeds the start of the alphabet, and the letters it does not contain fill the rest in normal order, producing a fixed one-to-one substitution.

How it works

The cipher alphabet is constructed in two stages, then mapped against the plain alphabet:

keyword  = MONARCHY
deduped  = M O N A R C H Y
remainder= B D E F G I J K L P Q S T U V W X Z
cipher   = MONARCHYBDEFGIJKLPQSTUVWXZ
plain    = ABCDEFGHIJKLMNOPQRSTUVWXYZ

To encode, find each plaintext letter’s position in the plain alphabet and emit the cipher-alphabet letter at the same position; to decode, do the reverse lookup.

Example and notes

With the keyword MONARCHY, the word FLEE encodes to IGAA because F→I, L→G, E→A, E→A. Decoding IGAA with the same keyword returns FLEE. Because the mapping is fixed for the whole message, the cipher keeps the frequency fingerprint of the language — E is still the most common letter under its substitute — which is exactly what makes it easy to break with frequency analysis on longer texts.

Ad placeholder (rectangle)