Cryptanalysis Techniques
"To know how to defend, you must first know how to attack."
Ten approaches to classical cryptanalysis, with seven hands-on demonstrations. Success depends on the cipher, evidence, language, key and message length; no technique here defeats a correctly used one-time pad.
Open Codebreaker's Workbench β Open Cipher Detective β10 Techniques That Break Classical Ciphers
Long English samples often have frequencies near E=12.7%, T=9.1%, A=8.2%, with variation by text. A fixed one-to-one substitution preserves the sampleβs counts while relabeling letters. Compare counts and sequences to propose mappings; frequency alone does not guarantee key recovery. Homophonic and syllabic systems need additional analysis.
In repeating-key Vigenère, the same plaintext at the same key phase produces the same ciphertext. Repeated ciphertext fragments can suggest key periods through factors of their spacing. Accidental repeats also occur, so candidate periods need further tests.
Measures the probability that two distinct sampled positions contain the same letter. Long English samples often lie near 0.066; independent uniform AβZ text has expected IC 1/26 β 0.0385. These are reference values, not bounds: an observed IC can range from 0 to 1. Coincidence statistics can suggest repeating-key periods, but do not identify a cipher by themselves.
Cribs are hypotheses about plaintext, suggested by message formats, context or repeated phrases. Against Enigma, analysts tested those hypotheses against machine constraints and additional traffic. Known plaintext is an attack model that modern encryption must withstand; it is not automatically a fatal weakness.
Known plaintext can expose a classical cipher's key. For a 2Γ2 Hill cipher, two matched plaintext/ciphertext blocks suffice when the plaintext-block matrix P is invertible modulo 26: gcd(det(P), 26) = 1. Otherwise, more observations or other analysis are needed. Enigma cribs impose different, rotor-machine constraints.
Start with a random key. Decrypt. Score the result using English language statistics β common digrams like TH, HE, IN. Make random changes to the key. Keep improvements, discard downgrades. Use multiple starting points to explore candidates. Such searches can attack substitution, Playfair and transposition, but may stall at local optima or favor incorrect plaintext.
Genetic algorithms explore populations of candidate keys; simulated annealing sometimes accepts worse-scoring moves. These methods can help attack classical ciphers, but time and success depend on the problem and settings. A high language score does not prove a correct plaintext.
Japan's Purple machine routed plaintext through banks of telephone-style stepping switches rather than rotors. The US Signals Intelligence Service had no machine to study, so they hunted statistical regularities in intercept traffic β looking for cycles in how the switches advanced. Genevieve Grotjanβs September 1940 insight was a crucial step in the teamβs reconstruction of the switch behavior. SIS built an analog machine, enabling decryption of Purple diplomatic messages. MAGIC was the wider intelligence product, not the name of this single attack.
Knight, Megyesi and Schaefer combined careful transcription, symbol statistics and linguistic reasoning to decipher Copiale. Their 2011 paper describes unsuccessful early automatic-decryption attempts, then progress after treating the Roman letters as spaces and grouping likely homophones. This was a combination of computation and human analysis, not an EM algorithm automatically discovering the answer. Original Copiale paper.
The disclosure of Byrneβs Chaocipher algorithm in 2010 made independent implementation and attack possible. Subsequent research studied known-plaintext and ciphertext-only attacks under specified conditions. Distinguish revealing an algorithm from recovering a secret starting state. Researchersβ record of attacks and solved exhibits.
Search speed depends on the problem: Short repeating keys and long, ordinary-language messages can be easy for automated solvers. Short texts, unusual vocabulary, layered ciphers and poorly chosen scoring models can remain difficult. The demonstrations here are examples, not measured performance guarantees.
Try the Techniques
Apply cryptanalysis tools to real ciphertext.
IC = Ξ£ ni(niβ1) / N(Nβ1) Β· β
Letter Frequencies (gold = input, outline = English)
Al-Kindiβs surviving treatise describes frequency-based cryptanalysis. A monoalphabetic substitution preserves counts while relabeling symbols; polyalphabetic substitution changes that relationship, but need not make a short sample uniform. Language frequencies are evidence for hypotheses, not a guarantee of successful decryption.
Additive-cipher crib test. Slide a guessed plaintext word across a VigenΓ¨re or running-key ciphertext. At each position this tool computes a possible key fragment, (ciphertext β crib) mod 26, with A = 0. A repeating fragment is a hypothesis to test against other text, not confirmation of the crib or key. Enigma crib attacks instead test rotor and plugboard constraints; this subtraction is not the Enigma attack.
For an additive cipher such as VigenΓ¨re, known plaintext reveals the keystream only at the matching positions: Key[i] = (Cipher[i] β Plain[i]) mod 26. Align both inputs at their first letter. A repeating fragment suggests a possible period; finite observations do not prove that the rest of the key repeats.
To explore a hypothesis, enter a period no longer than the observed keystream. Any extension beyond the known plaintext remains unverified.
Reading: Joshua Holden, The Mathematics of Secrets: Cryptography from Caesar Ciphers to Digital Encryption (2017 edition), Β§Β§5.1β5.2, distinguishes repeating keys, running keys, and one-time pads.
Watch a small Caesar-key search score candidate shifts against English frequencies. It illustrates greedy search, not a guaranteed solve: a short or unusual message may score best under an incorrect key.
The objective is the mean reference frequency assigned to each letter: sum(reference frequency of each letter) / letter count. Higher scores are preferred. This measures a preference for common letters, not distance from an English frequency distribution.
Counterexample: HELLOWORLD and its reversal DLROWOLLEH both score 5.85; EEEEEEEEEE scores 12.7. A score optimum can be wrong even when every key has been checked.
Simulated annealing sometimes accepts worse-scoring candidates to escape local optima. This Caesar example illustrates the rule; a finite run does not guarantee the globally best score or the authentic plaintext.
The objective is the mean reference frequency assigned to each letter: sum(reference frequency of each letter) / letter count. Higher scores are preferred. This measures a preference for common letters, not distance from an English frequency distribution.
Counterexample: HELLOWORLD and its reversal DLROWOLLEH both score 5.85; EEEEEEEEEE scores 12.7. A score optimum can be wrong even when every key has been checked.
12 Famous Codebreaks in History
Selected attacks and advances, with their evidence and limitations.
An early surviving systematic account of frequency analysis. Its effectiveness depends on the cipher and available text.
Babbage worked on attacks against repeating-key polyalphabetic ciphers but did not publish his method. Kasiski independently published an approach in 1863.
Kasiski published a method using repeated ciphertext groups to investigate the period of repeating-key polyalphabetic ciphers. Publication did not make every polyalphabetic system immediately readable.
Rejewski reconstructed military Enigma in 1932; Polish analysts subsequently developed several attacks and aids, including the bomba in 1938. Their July 1939 exchange with Britain and France shared methods and reconstructed machines.
Purple provided valuable Japanese diplomatic intelligence. It did not reveal a complete operational plan for the Pearl Harbor attack; diplomatic and naval communications used different systems.
IBMβs designers knew a form of differential cryptanalysis while developing DES and used it in selecting the S-boxes. Biham and Shamir later developed the technique publicly. Its effectiveness depends on the cipher and the available data.
Polish mathematicians reconstructed military Enigma before the war. Later Allied bombe machines used crib-derived constraints to eliminate settings. The intelligence contribution was substantial; a precise number of years removed from the war cannot be measured.
Tiltmanβs 1941 work and Tutteβs structural reconstruction preceded Colossus. The electronic machine became operational in February 1944 and accelerated statistical wheel-setting searches.
Duplicated Soviet pad material enabled attacks on some traffic. Analysts also had to reconstruct codebook meanings; recovery was partial and often took years. VENONAβs success did not break the perfect-secrecy guarantee of a correctly used one-time pad.
Linear approximations enabled a statistical attack on DES under a large known-plaintext requirement. The often-cited 2β΄Β³ figure is a data requirement for a particular attack, not an unconditional reduction of all attack costs to 2β΄Β³.
Kocher described how data-dependent execution times can leak secret information from implementations, including RSA. Such attacks require suitable observations and vulnerable implementations; they do not solve the underlying factoring problem.
The SHAttered team produced two different PDFs with the same SHA-1 digest. This demonstrated a practical collision and reinforced a migration already underway; collision resistance and preimage resistance are different properties.
The Big Pattern: These cases combine mathematical analysis with operational evidence, protocol weaknesses and implementation behavior. Reused pad material, predictable plaintext and timing leakage create different attack opportunities. Predictable plaintext is not itself an error: modern encryption should protect it under the stated attack model.
From papers to inspectable evidence
Evidence Workbench Β· Copiale, Mary Stuart and Z340 investigations Β· Modern attack conditions
Reading the search score
George Lasry, A Methodology for the Cryptanalysis of Classical Ciphers with Search Metaheuristics (2018 published thesis), Β§Β§3.2.1β3.2.4, printed pp. 29β34 / PDF pp. 50β55, and Β§4.5, printed pp. 56β57 / PDF pp. 77β78, distinguishes objectives, selectivity and resilience to key errors. The small Caesar landscape above is an original teaching example; it does not reproduce the thesisβs large-key experiments.
Reading
Joshua Holden, The Mathematics of Secrets: Cryptography from Caesar Ciphers to Digital Encryption (2017 edition), chapter 2 and Β§Β§5.1β5.2; David Kahn, The Codebreakers: The Comprehensive History of Secret Communication from Ancient Times to the Internet (revised edition, 1996); Robert L. Benson, The VENONA Story (Center for Cryptologic History edition, 2001), pp. 1β3, 7 and 14β17. The demonstrations illustrate hypotheses and search rules, not guaranteed recoveries.