Statistical Cryptanalysis

Cipher Detective

Paste unknown ciphertext and the Detective will walk you through the evidence — letter frequencies, Index of Coincidence, chi-square analysis, Kasiski examination — and show which cipher families best fit the data.

Awaiting input. The Detective analyses text as you type or paste.
Prepare a transcription — preserve the evidence

Evidence Workbench adds source revisions, image regions, alternative readings, numerical segmentation and homophonic search. Follow the historical decipherment investigations.

Keep the original symbols, spacing and line breaks before making an analysis copy. This workspace is independent of the live Detective input above. A question mark represents one unreadable symbol; a token can also be marked uncertain or missing. This is a small transcription tool, not OCR.

Groups restart at each space or line break. Excluded symbols end a group too; an incomplete group stays visible. Review and explicitly clear annotations before editing the text or tokenization. A change of width does not resolve an uncertain symbol.

Transcription tokens and uncertainty
PositionTokenStatus

Reading: Bernhard Esslinger, Learning and Experiencing Cryptography with CrypTool and SageMath (2024), Chapter 3 §§3.4–3.5.1. See the CrypTool Transcriber and Solver project for document transcription tools, and the reading companion.

Solve a substitution cipher by hand

First time? Follow a complete beginner lesson with contextual clues before trying your own message here.

Build a partial key from cipher letters to plaintext letters. A dot (·) means unknown. This mode assumes a one-to-one A–Z substitution; homophonic ciphers need different rules. Spaces and punctuation are preserved, and word-pattern matching assumes the supplied word boundaries are real.

Enter a plaintext letter beneath each cipher letter. Lock a mapping to keep it while trying suggestions; unlock it before editing. Changing ciphertext starts a fresh key, and Undo restores the previous text, key and locks.

Frequency suggestions fill empty, unlocked entries without displacing your assignments. They are guesses, not a solution. The separate Auto-Solve panel does not modify this desk or use its constraints.

Compare the patterns in ABBA AB with the small supplied dictionary.

A result is compatible only with this dictionary and your current key hypotheses. Even a sole candidate is not proof of the original message. No word boundaries are invented for continuous text. Pattern matching requires resolved A–Z words separated by whitespace; unknown symbols and punctuation must not be silently treated as boundaries. To keep the search responsive, use at most eight distinct cipherwords, each no longer than 20 letters.

Reading: Al Sweigart, Cracking Codes with Python (2018), Chapter 17: word patterns and intersecting mappings. This small original fixture teaches the constraint step, not the full book’s dictionary attack. Continue the reading trail.

What the Detective can’t tell you

  • Short ciphertext can make statistical analysis unreliable; the roughly 60-character warning is a teaching heuristic, not a universal threshold.
  • English-language scores can mislead on non-English plaintext.
  • Random-looking data may be encrypted, compressed or simply random. These letter-based heuristics cannot reliably identify a modern cipher, establish its security or prove that a sample is encrypted.
  • Layered constructions and simplified machine models can confound single-pass identification.
  • The Detective’s Auto-Solve can recover plaintext for Caesar, ROT13, Atbash, Vigenère, monoalphabetic substitution, and columnar transposition. For richer hand-tools and other ciphers, open the Codebreaker’s Workbench.