The Playfair Cipher is a digraph substitution cipher invented by Charles Wheatstone in 1854 and popularized by Lord Playfair. Instead of encoding single letters, it encrypts pairs of letters (digraphs) using a 5×5 grid constructed from a keyword. This makes it significantly stronger than simple monoalphabetic ciphers because frequency analysis is applied to letter pairs rather than single letters.
To construct the grid, write the keyword first (dropping duplicate letters) and then fill in the remaining letters of the alphabet (I/J are typically combined). Each letter appears exactly once in the 5×5 table.
Playfair Cipher: Encoding
Suppose the plaintext message is "HELLO WORLD" and the keyword is "MONARCHY". First, remove spaces and treat I/J as equivalent if needed, then split into digraphs:
Plaintext (no spaces): HELLOWORLD
Split into digraphs: HE LL OW OR LD (duplicate letters in a digraph are separated with an X if needed) Next, construct the 5×5 Playfair grid using the keyword:
M O N A R
C H Y B D
E F G I K
L P Q S T
U V W X Z Apply Playfair rules for each digraph:
- If both letters are in the same row → replace each with the letter to its right (wrap around to start of row if needed).
- If both letters are in the same column → replace each with the letter below it (wrap around to top if needed).
- If letters form a rectangle → replace each letter with the one in the same row but in the column of the other letter of the pair.
Using this grid and these rules, the plaintext digraphs encrypt to the ciphertext:
HE → CF
LL → SU
OW → NV
OR → MT
LD → C
Ciphertext: CFSUNVNMTC Playfair Cipher: Decoding
To decode, split the ciphertext into digraphs (CF SU NV MT C) and reverse the rules:
- Same row → letter to the left.
- Same column → letter above.
- Rectangle → swap columns again.
Decoding CFSUNVNMTC with the keyword MONARCHY restores the plaintext:
CF → HE
SU → LX
NV → OW
MT → OR
C → LD
Plaintext: HELXOWORLD Playfair Cipher: Notes
The Playfair Cipher is historically significant for its use in military and diplomatic communications before the widespread adoption of more modern ciphers. Its use of digraphs makes it resistant to simple frequency analysis, though cryptanalysis techniques like the Kasiski examination can still reveal patterns. Always agree on keyword, I/J convention, and filler letters beforehand.