π§ Ciphers & Codes
Turning nonsense back into language with pattern and frequency.
βWhat one man can invent another can discover.β
β οΈ The common misconception Simple ciphers do not hide a message from a determined mind β they only delay it. Language leaves fingerprints that survive the disguise.
The weakness of substitution
The dancing men, the Caesar shift, the pigpen β all are substitution ciphers, replacing each letter with another symbol by a fixed rule. Their fatal flaw is that they preserve the statistics of the language underneath. "E" is the commonest letter in English by a wide margin; "TH", "HE" and "AN" are the commonest pairs; and single-letter words are almost always "A" or "I". The disguise changes the costumes but not the crowd.
Frequency analysis, step by step
This is exactly how Holmes cracks the dancing men. Count the symbols; the most frequent is probably E. Look for a short symbol that recurs at word-ends as a likely S or T. Seed the solution with a word you can guess β a name, a repeated short word β and let each recovered letter constrain the rest, until the whole alphabet falls like a row of dominoes. Ninth-century Arab scholars formalised this a thousand years before Baker Street.
The arms race after
Ciphers that resist frequency analysis β the VigenΓ¨re\'s shifting key, the book cipher of The Valley of Fear β do so by breaking the one-to-one mapping, so a single plaintext letter no longer always becomes the same symbol. The whole history of cryptography is this escalation between the pattern-hider and the pattern-finder, running straight through to the machines of the twentieth century.
How to practise it
The Dancing Men Cipher Bureau lets you write in the stick-figure alphabet, decode with a dancing keyboard, and β crucially β run a Caesar cracker that ranks every shift by how English the result looks, so you can watch frequency analysis work. Cipher Sprint then turns decoding into a timed game against the clock.
Practise it
Dancing Men Cipher Bureau
Secret messages in the famous stick-figure cipher, plus Caesar (with a cracker), VigenΓ¨re, and Atbash β instant, in your browser.
About & launch βCipher Sprint
Sixty seconds, dancing men marching in β decode as many words as you can before the clock runs out.
About & launch βRelated techniques
Where Holmes uses it
Concrete moments from the canon β how the method actually plays out in the cases. Contains spoilers.
The Porlock message is a book cipher β useless without the key text; Holmes reasons out which book (large, two columns, standardised) and lands on Whitaker's Almanack.
A concealment cipher rather than a substitution: the trick is realising the noise words are padding and testing skip-intervals until sense appears.
The ritual is a spatial cipher: decoding means executing it β shadow lengths from a vanished elm recovered via its recorded height, catechism turned into survey.
The canonical frequency attack: assume the most frequent glyph is E, use flag-markers as word-ends, seed known words like the wife's name, and expand until the alphabet falls.
Candle-flash signalling decoded by counting: flashes grouped into letters (one for A, and so on) turn a flickering window into sentences of warning.