Maths●●●●●Difficulty 2 of 5

How did counting letters crack secret codes for centuries?

A scrambled message looks like nonsense, but some symbols in it still show up far more than others. That one fact broke codes for a thousand years.

▶ Start the story

Secret messages that scramble every letter into a different symbol can still be cracked just by counting. In any long stretch of a language, some letters turn up far more often than others: in English, E, T, A and O are the most common, Z, Q, X and J are rare, and pairs like TH, ER, ON and AN show up constantly. A simple substitution cipher, where a given plaintext letter always becomes the same ciphertext symbol, cannot erase that pattern. So a codebreaker who counts the symbols in a scrambled message and matches the most frequent ones to the most frequent real letters can start prying it open, one guess at a time.

This trick has a documented origin. The first known recorded explanation of frequency analysis, and in fact of any kind of cryptanalysis, was given in the 9th century by the Arab polymath Al-Kindi, in a work called A Manuscript on Deciphering Cryptographic Messages. Some scholars suggest that close study of the Qur'an first revealed that Arabic writing has its own characteristic letter frequencies. Al-Kindi, who also oversaw the translation of Greek texts into Arabic in Baghdad's House of Wisdom, built on earlier work by al-Khalil; his manuscript is credited with the earliest known use of statistical inference. The idea later spread into Europe, and by 1474 the Italian statesman Cicco Simonetta had written his own manual on breaking Latin and Italian ciphers.

A page from a historic Arabic manuscript filled with dense cursive Arabic script.
The first page of Al-Kindi's ninth-century Manuscript on Deciphering Cryptographic Messages, the earliest known recorded explanation of frequency analysis.Photo: Unknown; uploaded by en:User:Jidan · Public domain

Codemakers fought back by muddying the pattern. Homophonic substitution gave a common letter several different disguises; polyalphabetic substitution, credited first to Leone Alberti, rotated between several alphabets; polygraphic substitution, used in the Playfair cipher, scrambled pairs of letters as a single unit. Each trick made frequency analysis harder, but also made encrypting correctly harder, which invites mistakes.

Counting letters stayed useful astonishingly long. In World War II, the British and Americans recruited codebreakers through newspaper crossword contests, and some Axis ciphers, including Japanese consular codes, still fell to simple counting. It took rotor machines like Enigma to finally defeat straightforward frequency analysis. Today a computer finishes the count in seconds.

Quiz me

0/3

  1. 1.Why can frequency analysis break a simple substitution cipher?
  2. 2.What is Al-Kindi credited with in the history of cryptanalysis?
  3. 3.Why did rotor machines like Enigma defeat straightforward frequency analysis?

Recap

A cipher that swaps the same letter for the same symbol every time preserves the language's letter frequencies, and that surviving pattern is what gives it away.

Surprising fact · Possibly inspired by study of the Qur'an, the ninth-century polymath Al-Kindi wrote the first known description of breaking any cipher at all.

Sources (3)

No source, no claim. Every fact in this lesson (19 claims) cites at least one of these.

  1. [1]Frequency analysis · Wikipedia
  2. [2]Al-Kindi · Wikipedia
  3. [3]Enigma machine · Wikipedia
More lessons in ➗ Maths (3) See all maths lessons →

One more light on your map.

Get one lesson like this every day, about the things you love. Free, in two or five minutes.

Get the share card for this lesson ↗