Skip to content
Cipherloom密码织机

CIPHER/SUBSTITUTION/PLAYFAIR SQUARE

Playfair Square

Published 14 Sep 2026 · · 8 min read

Playfair was the first practical cipher to encrypt letter pairs rather than single letters, and that one design decision bought it eighty years of useful service. It was invented by Charles Wheatstone in 1854, championed by Lord Playfair, adopted by the British War Office, and used in the Boer War and the First World War. It is breakable, but it takes a trained analyst hours rather than a bored clerk minutes.

Era
Modern
Type
Substitution
Key space
25! squares / digraph alphabet
Level
Field
Cipher loom plate: Playfair Square
plate playfair-square · Substitution

IPhenomenon

Build a 5 x 5 square from a keyword, dropping repeated letters and merging I with J. With the keyword CIPHER:

CIPHE
RABDF
GKLMN
OQSTU
VWXYZ

Now split the plaintext into digraphs: LO OM NE VE RS TO PS. Two letters that land in the same row are each replaced by the letter to their right (wrapping around). Two in the same column are each replaced by the letter below. Two in different rows and columns are each replaced by the letter at the other corner of the rectangle they form.

That third rule is the clever part. It means a single plaintext letter can leave as one of eight different ciphertext letters depending on its partner, and each output letter depends on two input letters at once. Frequency analysis on single letters stops working because there is no longer a stable symbol for any letter.

Repeated pairs like LL are separated by inserting a filler X (LX LX), and a trailing odd letter is padded the same way.

IIKey space

A Playfair square is a permutation of 25 symbols, which suggests 25! = 15,511,210,043,330,985,984,000,000 keys. That figure is misleading in two ways.

First, the keyword construction means real keys come from a much smaller pool: squares actually derived from memorable keywords number in the thousands.

Second, cryptanalysis does not need to find the square. It needs to find the mapping, and Playfair's digraph rules mean the mapping is recoverable from relatively little text. Modern published analyses recover a square from roughly 70 to 120 letters of ciphertext. That is a paragraph.

The practical lesson: the number of keys is not the same as the number of distinguishable keys given the plaintext you can observe.

IIIEnciphering

  • Choose a keyword, strip duplicates, and fill a 5 x 5 square; I and J share one cell.
  • Break the plaintext into digraphs.
  • Never allow a digraph of two identical letters: insert X between them. BALLOON becomes BA LX LO ON.
  • If the message ends on an odd letter, append X.
  • Locate both letters of each digraph in the square.
  • Same row: replace each with the letter to its right, wrapping from the end of the row to the start.
  • Same column: replace each with the letter below it, wrapping from the bottom to the top.
  • Rectangle: replace each with the letter at the opposite corner, keeping the row of the other letter.

IVDeciphering

  • Rebuild the square — the receiver knows the keyword.
  • Split the ciphertext into digraphs and apply each rule in reverse: same row, shift left; same column, shift up; rectangle, opposite corner.
  • Remove the X fillers. Do this with judgement: an X that appears between two identical letters, or at the very end of the message, is a filler; an X anywhere else is data.
  • Rejoin the words using context. Playfair alone does not preserve them.
  • If the message does not read, look for a transmitter error: a single mis-copied letter corrupts two plaintext letters, and the corruption is usually visible as a nonsense word.

VWeakness

Digraph statistics. Pairs are not uniform. TH, HE, IN, ER, AN and RE dominate English digraph counts, and a large enough corpus still leaks those frequencies.

The rectangle rule is invertible from structure. Given several ciphertext pairs that share a row or column, an analyst can reconstruct the square's row and column memberships without ever guessing the keyword.

The filler convention leaks. Wherever you see X in the plaintext, the writer inserted it — which tells the analyst exactly where doubled letters and word ends were. Many field procedures also broke messages at word boundaries, preserving word lengths entirely.

It was always the second-best option. Britain's own analysts told the War Office in 1915 that Playfair was suitable for short messages and unsuitable for long ones, and that assessment was correct.

VIPractice

Ciphertext

JSVSGTIYCFTNQIXH

Hint: Keyword CIPHER. Build the square, then apply the reverse of each rule to each digraph.

Reveal the answer

Plaintext

LOOM NEVER STOPS

This entry is historical and educational. It is not guidance for circumventing the security of any system in use today, and it is not professional advice.

·History note

Wheatstone offered the cipher to the British government in 1854; the Under-Secretary of State for War, Lord Playfair, attached his name to it while promoting it. The Foreign Office rejected it as too complex to teach to clerks, but the War Office adopted it for field use. It was used in the Second Boer War and in the First World War, notably by British forces in Mesopotamia, and by the Australians at Gallipoli. The Germans used it too, in some early naval traffic, until their own cryptanalysts broke it — and the British continued to use it for tactical traffic long after it was known to be solvable, on the grounds that solving it took longer than the operational life of the message.

·Further reading

The Playfair's real contribution is the idea of diffusion: make each output symbol depend on more than one input symbol, so that changing one letter of the plaintext changes several letters of the ciphertext. That concept is the direct ancestor of Claude Shannon's 1949 design criteria, and it is why AES processes 128-bit blocks rather than single bytes.

Playfair diffuses two letters. AES diffuses a whole block through successive rounds of substitution and permutation. Same idea, four hundred per cent more compute.

Next on the loom: enigma-rotor — polyalphabetic, mechanical, and famously confident right up until it was not.

+Weave into