How to Recognize Classical Ciphers: A Field Guide

When an unfamiliar ciphertext appears, the tempting move is to guess a famous name immediately: Playfair, Bifid or ADFGX. A more productive first question is what happened to the original symbols. They may have been replaced, rearranged, converted to coordinates or split into smaller pieces before being shuffled. Each operation leaves evidence, but no single clue provides a final identification.
This field guide covers ciphers that still turn up in CTFs, geocaching, historical exercises and puzzle hunts. It begins with a general workflow, then applies the same pattern to transposition, the Polybius square, Playfair, Bifid and the ADFGX family. The examples use the Latin alphabet because that is the model supported by the related tools.
Preserve the evidence before cleaning it
Do not remove spaces and punctuation from the only copy of a message. Fixed-size groups, unusual separators and surviving word boundaries can reveal how a text was transmitted. Make a normalized copy for calculation, but keep the original beside it.
The first pass only needs four steps. Inspect the alphabet and length, then compare letter frequencies with those of the likely language. Calculate the index of coincidence and note repeated fragments, while treating both as clues rather than verdicts. Finally, test several plausible transformations and check whether a readable candidate encrypts back to the original ciphertext.
Short ciphertexts are especially ambiguous. A low index of coincidence may come from a polyalphabetic cipher, a fractionating cipher or an unlucky small sample. Plaintext-like letter frequencies suggest transposition, but they do not reveal which transposition was used.
Transposition: the letters survive but their order does not
Rail fence writes a message in a zigzag across several rows and then reads those rows in sequence. With three rails, WEAREDISCOVEREDFLEEATONCE looks like this:
W . . . E . . . C . . . R . . . L . . . T . . . E
. E . R . D . S . O . E . E . F . E . A . O . C .
. . A . . . I . . . V . . . D . . . E . . . N . .
Reading across produces WECRLTEERDSOEEFEAOCAIVDEN. Columnar transposition uses the same broad idea, but places the message in rows under a keyword and reads columns according to the alphabetical order of the key letters.
The mechanics explain the statistical trace. No letter has been replaced, so the overall histogram and index of coincidence remain close to the source language. That is a good reason to test the transposition family, not enough reason to announce one exact cipher. Rail fence offers a convenient check because a small range of rail counts can be tried directly. Columnar transposition needs the key, its likely length or an additional structural guess.
Encryption Toolbox tries rail counts from 2 through 12. Universal Decoder performs a similar bounded search and ranks the outputs by their resemblance to ordinary language. Neither tool automatically recovers a word key for columnar transposition.
Polybius: from torches to a coordinate grid
In Book 10 of The Histories, Polybius described a system that divided the Greek alphabet into five groups. Two sets of torches indicated the group and the position of a letter within it. This is an important ancestor of coordinate ciphers, but the familiar English grid with I and J sharing a cell should not be projected unchanged into antiquity.
Its common teaching form is:
1 2 3 4 5
1 A B C D E
2 F G H I K
3 L M N O P
4 Q R S T U
5 V W X Y Z
J is normalized to I in this version, so HELLO becomes 23 15 31 31 34. A keyword can change the square by placing its unique letters first and filling the remaining cells with the unused alphabet.
Coordinates retain a direct relationship with letters, so identical pairs repeat with the frequencies of the underlying text. A string containing only digits 1 through 5 in an even count is consistent with a 5x5 square, but tap code, Nihilist and other systems use similar notation. Verification means splitting the digits into pairs, trying an appropriate square and, when a key is involved, checking the reverse transformation.
Playfair: one operation over two letters
Charles Wheatstone described this digraph cipher in 1854, while Lord Playfair's promotion gave the system the name that survived. The attribution to Wheatstone also appears in material from the NSA Center for Cryptologic History.
Playfair builds a keyed 5x5 square, divides prepared plaintext into pairs and transforms each pair according to its geometry. Letters in one row move to the right, letters in one column move down, and a pair in different rows and columns takes the other corners of its rectangle. Repeated plaintext letters are separated with a filler, usually X, and an incomplete final pair is padded.
With the key PLAYFAIREXAMPLE, HIDETHEGOLDINTHETREESTUMP becomes BMODZBXDNABEKUDMUIXMMOUVIF. The example shows both the benefit and the inconvenience: single-letter frequencies are obscured more effectively than in simple substitution, but the recipient must decide which X characters belong to the message and which were inserted during preparation.
The common variant has a recognizable cluster of clues: even length, no J and no doubled letter inside a ciphertext pair. It is not a unique fingerprint. Another square convention may merge different letters, random text can satisfy the same tests and a short sample proves very little. The tools use these signs to raise Playfair among the candidates; actual decoding still needs the square key.
Bifid: coordinates begin to affect one another
French cryptographer Félix Delastelle first presented the principle behind Bifid in 1895 under the name cryptographie nouvelle. A fuller account appeared in his posthumously published 1902 Traité élémentaire de cryptographie.
Bifid starts with the same 5x5 square but does not keep the two coordinates of each letter together. Within a block of a chosen length, called the period, it writes all row numbers first and all column numbers second. The combined sequence is divided into pairs again and mapped back through the square:
plaintext: D E F E N D
rows: 1 1 2 1 3 1
columns: 4 5 1 5 3 4
regrouped: 11 21 31 45 15 34 = AFLUEO
One output letter can now combine coordinates that came from different input letters. This tends to flatten single-letter frequencies, and changing the period changes the result even when the square stays the same. On a long message the index of coincidence is often below that of plaintext, but its value also depends on the period, key and message. The shortcut “low IC plus no J means Bifid” is therefore unreliable.
Verification requires both the square and the period. Universal Decoder does not recover them from ciphertext alone. When the user supplies a keyword, it tries periods from 3 through 7. Encryption Toolbox lets the user set the key and period explicitly and check both directions.
ADFGX and ADFGVX: fractionation before transposition
German signals officer Fritz Nebel designed ADFGX for field radio traffic, and the system entered use on the Western Front in March 1918. Each plaintext letter first became two coordinates from a 5x5 square labelled A, D, F, G and X. Those symbols had sharply distinguishable Morse patterns, reducing transcription mistakes. A second keyword then applied columnar transposition to the entire coordinate stream.
The first stage doubles the length and the second separates coordinates that originally belonged to one letter. The final ciphertext therefore contains only five permitted symbols and normally has an even length, although formatting, omissions or damage to an intercept can disturb that clue. The restricted alphabet is much stronger evidence than a broad frequency score, but reading the message still requires the square arrangement and the transposition key.
On 1 June 1918, the German Army introduced the expanded ADFGVX version. Adding V allowed a 6x6 square to hold all 26 letters and ten digits. The French Ministry of the Armed Forces describes the new V appearing in intercepts and the work of Georges Painvin's group. Declassified William Friedman lectures give the success a useful scale: Allied cryptanalysts recovered keys for only some days, but heavy traffic on those days exposed a substantial share of the messages.
Encryption Toolbox implements both forms with one square key and a separate column key. ADFGX maps J to I and accepts Latin letters, while ADFGVX also preserves digits. The identifier readily notices the restricted alphabet, but it does not recover the two keys automatically.
A table for the first hypothesis
| Family | Operation | Visible clue | Practical check |
|---|---|---|---|
| Rail fence | Read a zigzag row by row | Language frequencies survive | Try a small range of rail counts |
| Columnar transposition | Read columns in key order | Language frequencies survive, periodic structure may appear | Need a key length, key or crib |
| Polybius square | Replace a letter with a coordinate pair | Digits 1–5, usually an even count | Split into pairs and test a square |
| Playfair | Transform letter pairs through a square | Often even length, no J, no doubles inside pairs | Need the keyed square |
| Bifid | Mix coordinates within each period | Letters only, flatter frequencies, often no J | Need the square and period |
| ADFGX | Transpose ADFGX coordinates | Only A, D, F, G and X | Need the square and column keys |
| ADFGVX | Use the same process with a 6x6 square | Only A, D, F, G, V and X | Need both keys; plaintext may include digits |
The table selects the next experiment; it does not diagnose a message from one line of evidence. If a candidate turns into coherent text, encrypt it again with the same settings. Reproducing the original ciphertext is much stronger confirmation than any frequency score.
What the related tools actually do
Encryption Toolbox is useful for a controlled experiment: choose an algorithm, enter its keys and compare encryption with decryption. Universal Decoder runs many decoders together, automatically searches Rail Fence and a few other bounded families, then ranks outputs by their resemblance to language. Playfair, Polybius, Bifid, ADFGX, ADFGVX and columnar transposition require a key hint; with such a hint, Bifid periods 3 through 7 are tested.
Both tools run locally in the browser, but local execution does not make the classical algorithms secure. They have no nonce, message authentication or modern security claim. Their sensible role ends with education, historical analysis and puzzles. Real secrets belong in modern protocols and vetted libraries, not a homemade stack of squares and transpositions.
Related tools
Frequently asked questions
Where should I start with an unknown classical ciphertext?
Preserve the original formatting first, then measure the length, character set, letter frequencies and index of coincidence in a separate working copy. A restricted alphabet such as ADFGX or pairs of digits from 1 to 5 is usually a stronger clue than a broad statistical profile. Test several plausible candidates and look for a readable result that can be encrypted back to the original ciphertext.
Why does Playfair encrypt letters in pairs?
Playfair transforms digraphs, which weakens the direct link between the frequency of one plaintext letter and one ciphertext letter. The common version uses a 5x5 square with I and J sharing a cell, separates repeated plaintext letters with X and pads an incomplete final pair. Those conventions create useful clues, but they do not prove that a message uses Playfair.
How is ADFGX different from ordinary substitution?
ADFGX first replaces every plaintext letter with a coordinate pair drawn from A, D, F, G and X, then applies a columnar transposition to the whole coordinate stream. The transposition separates the two coordinates of a letter, so decryption normally requires both the square arrangement and the column key. The final alphabet remains restricted to five symbols, which makes the family easy to suspect.
Can a cipher identifier name the algorithm with certainty?
No. Frequencies, index of coincidence, length and alphabet can rank hypotheses, but short samples produce coincidences and different algorithms can leave similar traces. Strong confirmation comes from a known key, a bounded parameter search or a readable result that reproduces the original ciphertext when encrypted again.
Can classical ciphers protect real data?
No. They have no modern security model, integrity protection or resistance to well-known cryptanalysis. They are useful for history, CTFs, geocaching and puzzles. Real data should use vetted libraries and authenticated encryption such as AES-GCM or ChaCha20-Poly1305, together with proper key management.



