9th centuryIraq, under the Abbasid caliphs
Al-Kindi counts the letters
1 The story
In the 9th century the philosopher al-Kindi, who worked for the caliphs, wrote a short treatise on reading secret messages. His idea: in every language some letters are common and others are rare. So count the letters of a long ordinary text, then count the signs of the secret message, and match them up: the most common sign with the most common letter, the second with the second, and so on. It is the oldest description of this method that survives. A copy was found in a library in Istanbul and printed in 1987.
Read more
Abu Yusuf Ya’qub ibn Ishaq al-Kindi was born in Basra and educated in Baghdad, and he served at the court of the caliphs. Later writers called him “the philosopher of the Arabs”. He wrote on philosophy, mathematics, medicine and much more; the treatise on secret writing is one short work among many.
For his counts he took a sample of ordinary Arabic text of 3,667 letters, and wrote down which letter came first, second, third and so on. Then, he explains, you do the same with the signs of the secret message and give each sign the letter of the same rank.
The method has a catch that you will meet in “Your turn”: in a short text the ranks do not come out exactly right. Counting gives you a start. Common words, and letters that often stand together, give you the rest.
2 The machine
Type or paste some English below. The bars count its letters. Then look at the same text in a secret alphabet: every bar is still there, just under another letter.
3 Your turn
Here is a message in a secret alphabet. We wrote it in English for this puzzle (al-Kindi worked in Arabic). Do what he describes: press Match by rank to give every sign the English letter of the same rank. A few words will appear. Then fix the rest by hand: type a letter into a sign’s box (two signs swap letters when you give one a letter the other had). Click a sign in the message to jump to its box.
Cracked · in your notebook
Stuck?
- The most common three-letter word in English is THE. Which three-sign word appears again and again?
- VIR is THE. QSX, also common, is AND. A word of one sign is A or I.
- The message starts KC XRQJ ZJARSX: MY DEAR FRIEND.
4 What really happened
Al-Kindi’s Risala fi istikhraj al-mu’amma, a treatise on cryptanalysis, is the oldest known text that explains how to break a substitution cipher by counting letters. The manuscript was found in the Süleymaniye Library in Istanbul by three researchers from Damascus, Mohammed Mrayati, Yahya Meer Alam and Hassan at-Tayyan, who edited it and printed it in Arabic in 1987. Their English translation, al-Kindi’s Treatise on Cryptanalysis, is the first book of the series The Arabic Origins of Cryptology.
Later Arab writers on secret writing, such as ibn Dunaynir and ibn Adlan in the 13th century, built on his method.
Then and now: the Toolbox’s frequency analysis counts letters for you, and its substitution solver does the whole job by trying millions of swaps.
Sources
- M. Mrayati, Y. Meer Alam, M. H. at-Tayyan (eds.), al-Kindi’s Treatise on Cryptanalysis, The Arabic Origins of Cryptology, book 1, translated by S. M. al-Asaad (English edition of the Arabic book printed in Damascus in 1987).
- B. Ycart, “Letter counting: a stem cell for Cryptology, Quantitative Linguistics, and Statistics”, Historiographia Linguistica 40(3), 2013, pp. 303 to 329 (open version on arXiv). arxiv.org
- M. I. Al-Suwaiyel, “Arab Origins of Cryptology”, Muslim Heritage, 2018. muslimheritage.com
- P. Adamson, “al-Kindi”, Stanford Encyclopedia of Philosophy (for his life). plato.stanford.edu