You are on page 1of 40

INTERNATIONAL ISLAMIC UNIVERSITY MALAYSIA

Kulliyyah of Engineering
Department of Electrical and Computer Engineering

MUSLIMS CONTRIBUTION IN CRYPTOLOGY


(MAIN CONTRIBUTION OF AL-KINDÔ)

COMPUTER NETWORK SECURITY


ECE 6106
SEMESTER I (10/11)
BY

NUURUL IFFAH CHE OMAR (G1017674)

SUBMITTED FOR

DR. WAJDI AL-KHATEEB


TABLE OF CONTENT

1. ABSTRACT...................................................................................................................................................... 4

2. OBJECTIVES ................................................................................................................................................... 5

3. SCOPE ............................................................................................................................................................ 6

4. INTRODUCTION ............................................................................................................................................. 7

4.1. BACKGROUND ..................................................................................................................................................7


4.2. FACTORS BEHIND THE ADVANCEMENT OF CRYPTOLOGY IN ARAB CIVILIZATION ............................................................11
4.3. CONTRIBUTIONS OF VARIOUS MUSLIM SCIENTISTS IN CRYPTOLOGY............................................................................13

5. MAIN CONTRIBUTION AL-KINDI .................................................................................................................. 18

5.1. OVERVIEW .....................................................................................................................................................18


5.2. BACKGROUND ................................................................................................................................................18
5.3. MAIN CONTRIBUTION OF AL-KINDÊ .....................................................................................................................21
1) Algorithms of Cryptanalysis. ......................................................................................................................21
2) The Major Types of Encipherment. ............................................................................................................22
3) Algorithms for Cryptanalysing Certain Types of Encipherment..................................................................25
4) Arabic Letters: Their Order and Frequency of Occurrence. ........................................................................26
5) Letter Combinations in Arabic. ...................................................................................................................26
5.4. VALUES OF CONTRIBUTION ...............................................................................................................................28
5.5. VARIOUS THOUGHTS ON AL-KINDÊ ......................................................................................................................28
5.6. CONCLUSION ..................................................................................................................................................28

6. APPLICATIONS OF FREQUENCY ANALYSIS .................................................................................................... 29

6.1. OVERVIEW .....................................................................................................................................................29


6.2. APPLYING FREQUENCY ANALYSIS METHOD...........................................................................................................29
6.3. CONCLUSION ..................................................................................................................................................38

7. CONCLUSION ............................................................................................................................................... 39

8. REFERENCES ................................................................................................................................................ 40

2
TABLE OF FIGURES

Figure 1: Spartan Scytale............................................................................................................................... 9


Figure 2: The piece of Rosetta Stone .......................................................................................................... 10
Figure 3: Map of Kufa, a city in Iraq. ........................................................................................................... 18
Figure 4: Bayt al-Hikma, burned second floor view, May 2003 .................................................................. 19
Figure 5: Abu Yousuf Yaqub Ibn Ishaq al-Kindi. .......................................................................................... 20
Figure 6: The principles of cryptanalysis ..................................................................................................... 22
Figure 7: This is the full representation of al-KindÊ’s major types of encipherment, pg 87 of the book.[12]
.................................................................................................................................................................... 23
Figure 8: The full representation of al-Kindi’s major types of encipherment, pg 87 of the book in Arabic24
Figure 9: Scanned image of A photocopy of the first page of al-KindÊ's treatise ....................................... 27
Figure 10: Scanned image of the last page of al-KindÊ's treatise. ............................................................... 27
Figure 11: Al-Kindi's Arabic letter frequency analysis................................................................................. 29
Figure 12: Quran text was taken from the book of Quran from tanzil.info................................................ 30
Figure 13: Screenshot of the use of Intellyze 3.0 Trial edition of surah al-baqarah. .................................. 30
Figure 14: Comparison of frequency analysis of al-baqarah and al-kindi's treatise. .................................. 31
Figure 15: Values of relative difference in letters ha and nun. .................................................................. 31
Figure 16: Comparison of frequency analysis of an arabic article and al-kindi's treatise .......................... 32
Figure 17: Comparison of frequency analysis of the Quran to other Arabic text. ...................................... 33
Figure 18: Letter frequency in English. ....................................................................................................... 34
Figure 19: Hamlet's famous lines, written in Early Modern English by Shakespeare.[16] ......................... 34
Figure 20: “To be or not To Be” frequency Analysis ................................................................................... 35
Figure 21: The News article letter frequency. ............................................................................................ 36
Figure 22: Comparison with the general English Letter frequency. ........................................................... 36
Figure 23: The encrypted message, deciphered. ........................................................................................ 37
Figure 24: The total count of single characters in the text is n=189 .......................................................... 38
Figure 25: The total count of triplets of characters in the text is n=18 ...................................................... 38

3
1. ABSTRACT

The Arabs were the first to contribute to cryptography as old manuscripts recently
discovered show that, the origin of cryptology and the Muslims contributions to it, are
older and more extensive than previously thought [1]. The Muslims did not translate the
scientific and philosophical works of other civilizations out of fear of political or
economic domination but because the structure of Islam itself is based upon the primacy
of knowledge[2]. They began to cultivate Islamic sciences based on what they had
translated, critically analyzed, criticized and approved of while rejecting what was not in
line with the Islamic perspective and made it part of their worldview. In cryptology, Dr.
Al-Kadi1 concluded that the Arabic word sifr for the digit zero, developed into the
European technical term for encryption [3]. As a Muslim and a scientist, it is important
for us to learn about and appreciate the contributions of the Islamic civilization by the
early Muslims. The 9th-century Arab scientist al-KindÊ is the author of the oldest known
book on cryptology, antedating any other by more than 300 years. This paper will include
introduction to cryptology and steganography, a brief history of cryptology and
cryptanalysis, introduction to Muslim scholars, their contributions, main contribution of
chosen scholar in cryptology and application of frequency analysis.

1 th
Ibrahim A. Al-Kadi born on 6 March 1954, is a Saudi electrical engineer, known especially for his work on
cryptology history and in the telecom regulation sector.

4
2. OBJECTIVES

 To obtain background knowledge on Muslim‟s contribution in cryptography.


 To review relative works and main contribution in cryptography.
 To implement al-Kindi‟s frequency analysis method.
 To enhance and improve knowledge on Muslim scientists.
 To learn from the history and to take lessons from it.

5
3. SCOPE

The scope of this paper is as follows:


 To focus on Muslim‟s Contribution in Cryptography
 Main Contribution of al-KindÊ

6
4. INTRODUCTION

4.1. Background

Cryptography or cryptology is derived from Greek κρσπτός, kryptos, meaning hidden or


secret and γράφ, gráph, "writing", or λογία, logia, respectively.2

a. What is cryptography and steganography

Cryptology3 is the study of techniques for ensuring the secrecy and/or authenticity of
information. The two main branches of cryptology are cryptography, which is the study
of the design of such techniques; and cryptanalysis, which deals with the defeating such
techniques, to recover information or forging information that will be accepted as
authentic [4]. Applications of cryptography include ATM cards, computer passwords,
and electronic commerce. There are three general types of encryption schemes:
symmetric, asymmetric and hash.

Steganography derives from the Greek word steganos, meaning covered or secret. In a
simple way, steganography is hidden writing, whether it consists of invisible ink on paper
or copyright information hidden in an audio file [5]. There are two general ways in which
you can categorize steganography techniques which are by type of host file and by how
the data has been hidden.

b. Fields in Cryptography and Steganography

A basic principle, adopted by all modern cryptographers, is that the algorithm which
defines any cryptosystem must be publicly available. Only then is it possible for the
cryptosystem to be subjected to peer review and critical analysis, so that users can have
confidence in it. This important rule of cryptography is known as Kerckhoffs' Principle.
Auguste Kerckhoffs4 stated that a cryptosystem should be secure even if everything about

2
Liddell and Scott's Greek-English Lexicon. Oxford University Press. (1984)
3
This a direct definition of cryptology from the book Cryptography and Network Security Principles and Practices
4
Auguste Kerckhoffs (1835 -1903) was a Dutch linguist and cryptographer , a professor of languages at the School
of Higher Commercial Studies in Paris[6] Auguste Kerckhoffs. Available:
http://en.wikipedia.org/wiki/Auguste_Kerckhoffs

7
the system, except the key, is public knowledge. It was reformulated by Claude Shannon5
as "the enemy knows the system". There are several areas of study in cryptography and
steganography.

Cryptography Steganography
 Symmetric-key cryptography  Physical steganography
 Public-key cryptography  Digital steganography
 Cryptanalysis  Network steganography
 Cryptographic primitives  Printed steganography
 Cryptosystems  Steganography using Sudoku Puzzle
Table 1: Areas of study in crptography and Steganography

These are various techniques available in cryptography and steganography. They have a
wide use and applications.
Cryptography Steganography
1. DNA Cryptography Translation-Based Steganography
2. Pairing-Based Cryptography Model-Based Steganography
3. Position Based Cryptography, Wavelet-Based Steganography
4. Password-Based Cryptography Neural Based Steganography
5. Lattice-Based Cryptography Arabic Diacritics Based Steganography
6. Code-Based Cryptography Image Based Steganography
7. Chaos Based Cryptography. Peak-Shaped-Based Steganographic
8. Braid-Based Cryptography DNA-Based Steganography
9. Identity-Based Cryptography Meta Steganography
10. Torus-Based Cryptography
11. Odd-Even Based Cryptography
12. Position-Based Quantum
Cryptography
Table 2: Various techniques research over the years.

5
Claude Elwood Shannon (1916-2001) is considered as the founding father of electronic communications age.[7]
Claude Shannon. Available: http://en.wikipedia.org/wiki/Claude_Shannon

8
c. A Brief History of Cryptography & Cryptanalysis

Cryptography helps to ensure secrecy in private communications of spies, military


leaders and diplomats in the past. People have tried to conceal information in written
form such as stone inscription and papyruses. The Egyptians, Hebrews and Assyrians all
developed cryptographic systems. The first recorded use of cryptography for
correspondence was by the Spartans (400 BC) employed a cipher device called a
"scytale" to send secret communications between military commanders.

6
Figure 1: Spartan Scytale.

The scytale is a tapered baton, when it is unwound from the sender‟s scytale, the leather
strip appears as a list of random letters. Only by rewinding the strip around another
scytale of the same diameter will the message appear. The ancient Spartans and Greeks
used this cipher to communicate during military campaigns. It has the advantage of being
fast and not prone to mistakes which is very important when on the battlefield. It can,
however, be easily broken.
Nineteenth century scholars decrypted ancient Egyptian hieroglyphics when
Napoleon's soldiers found the Rosetta Stone in 1799 near Rosetta, Egypt. Its inscription
praising King Ptolemy V was in three ancient languages, Demotic, hieroglyphics and
Greek. Today, it remained in the British Museum after the French surrendered to the
British in Egypt.

6
Cryptography History; Ancient times; http://e-handel.mm.com.pl/crypto/intro/introduction_to_cryptography.htm

9
7
Figure 2: The piece of Rosetta Stone

The Arabs were the first people to clearly understand the principles of cryptography and
to elucidate the beginning of cryptanalysis. They devised and used both substitution and
transposition ciphers and discovered the use of letter frequency distributions in
cryptanalysis. In approximately 1412, al-Kindi gave explicit instructions on how to
cryptanalyze ciphertext using letter frequency counts including examples illustrating the
technique.

From all of the knowledge in Arab heritage, cryptology is given less attention to
from historians and researchers. None has ever embarked upon editing cryptological
manuscripts or attempted any work to reveal origins of this science. Moreover, it is one
of the secret sciences, about which writings are rare and whose circulation is restricted.
This is among several reasons why its rediscovery was delayed until the present day. The
rediscovery have enabled to disclose Arab negligence towards their own heritage, to
show their advances various sciences, the importance of their works and also to reveal the
impact they had on the Western scientific renaissance and the world science.

7
Cryptography History; Ancient times; http://e-handel.mm.com.pl/crypto/intro/introduction_to_cryptography.htm

10
4.2. Factors behind the Advancement of Cryptology in Arab Civilization

According to David Khan8, an American historian and chronicler of the history of


cryptology, “Cryptology was born among the Arabs. They were the first to discover and
write down the methods of cryptanalysis….grammar became a major study. And included
was secret writing.”[1] There are several factors as to why the Arabs were motivated and
progress in cryptology.[8]

1. The Arabs translated of a substantial amount of the heritage from the earlier civilizations
and the advantages they derived from that translation in their work. They studied what
had been achieved by others before undertaking their own independent studies and this is
considered a scientific methodology. Their translations scored a truly high standard of
excellence with respect to accuracy, scrupulousness and fidelity.

2. The Arabs took active interest in the study of their own language and its sciences, and
achieved many scientific results in linguistics. In this context, they undertook important
phonetics9 studies on consonants and vowels, and made quantitative and statistical
studies on the frequency of occurrence of letters, and their combination and non-
combination. They performed thorough research on morphology and syntax, their rules,
patterns, and regulations, as well as on other branches of linguistics such as semantics.
Furthermore, they were the first to produce dictionaries. Their huge progress in
linguistics had tremendous impact on their development of cryptology. Furthermore, The
Qur'an is accepted as the highest linguistic achievement of the Arabic language in every
possible respect.[9] It is a necessity for learning and reproducing the language of God's
Word in a way befitting its divine origin.[10]

3. The Arabs were very advance in mathematics. They were the earliest to develop the
science of algebra, arithmetic, geometry and other allied sciences. Muslims built
mathematical models using the decimal system, expressing all numbers by means of ten
symbols, and each symbol accorded the value of position as well as absolute value [11].
Many of the intellectual sciences were developed as a direct result of Muslims‟ needs to

8
David Khan in http://en.wikipedia.org/wiki/David_Kahn
9
a branch of linguistics that comprises the study of the sounds of human speech

11
fulfill the ritual and duties of worship. The Islamic duty of zakat or alms giving,
distribution of properties, determining prayer time, the direction of qiblah requires
precise scale and percentage and does not come without complicated math. Hence,
religion itself can instigate all sorts of scientific research that will become very useful.
Not only does it help solve religious problems, it can be used as a tool to solve many
other problems. A simple religious requirement necessitates very serious scientific
research.

4. The need for an effective administration of the Arab-Muslim state, which spread over a
vast area. Such an administration required comprehensive studies of different aspects,
among which was the science of cryptology. In the ØubÍ al-'a‘sÉ, which dedicated a
whole chapter in concealing secret information by al-QalqasandÊ10 and a 14-volume
encyclopedic book which contains a listing of some of the sciences needed by an
administrator in that era, indicates the advanced level of administration then. It is
therefore not surprising that al-Qalqa and and other authors on administrative sciences
should address the important topic of cryptology in their works. In addition, the need for
cryptology in wartime may be considered as one of the administrative factors leading to
the renewed interest in this science. This was practically demonstrated by several
important cryptographic works during the Mongol and Crusader invasions of Baghdad,
Damascus, Aleppo and Cairo.

5. The diffusion of reading and writing, assisted by the promotion of paper technology and
industry in the Arab-Islamic world and its close association with the Arabic culture. The
Holy Quran and Quranic sciences were also among the important factors in the progress
of cryptology. Many historians of cryptology confirm this fact when they consider that
one of the prominent factors which prevented the rise of cryptography and cryptanalysis
in the ancient Egyptian, Chinese, Indian and Babylonian civilizations was the limited
spread of reading and writing.

10
Ahmad al Qalqashandi: Shihab al-Din abu 'l-Abbas Ahmad ben Ali ben Ahmad Abd Allah al-Qalqashandi (1355 or
1356 -1418) was a medieval Egyptian writer and mathematician born in a village in the Nile Delta.

12
4.3. Contributions of various Muslim scientists in cryptology

In The Codebreakers by David Kahn, he wrote "Cryptology was born among the
Arabs"11 based on his discovery of an obscure journal article, which he later
called "... perhaps the most important single article on the history of cryptology."
After Kahn's discovery, the Arabs searched libraries around the world, locating
fifteen manuscripts that resulted in nine volumes on Arabic origins of
cryptography. The series which are translated into English reveals the history of a
school of Muslim cryptologists prevailing for more than six centuries.

Muslim scholars in cryptography and their works


There were many eminent Arab scholars in cryptology. This table is a direct copy
from the book [12]. The table was perfectly organized according to the
chronological precedence of the death dates of scholars listed.

11
The Codebreaker; David Kahn; 1996; p 98

13
14
15
16
Table 3: List of Muslim scholars’ contribution in cryptography

Not many of these scholars were known to the world but some were well known and
appreciated even in the west such as ÑAli ibn MuÍammad ibn ad-Durayhim , IbrÉÍÊm ibn
MuÍammad ibn DunaynÊr and Ya´qËb ibn IsÍÉq al-KindÊ.
The above list shows us that the Muslims were always in advance in science and the
scholars and their works are there to prove it. It is our duty take advantage of the knowledge.
For example, the great efforts done by the World Intellectual Property Organization (WIPO)
organizing the international touring exhibition "1001 Inventions12: Discover the Muslim
Heritage in our World" which had a grand opening in August 2010 in Istanbul. With the title
“Bringing life to Muslim Heritage” with a mission to discover 1000 years of missing history
and explore the fascinating Muslim contribution to present day science, technology, arts and
civilization.13

12
For more information, visit http://www.muslimheritage.com/
13
World Intellectual Property Organization (WIPO) published in September 2010 on its website an interesting
article

17
5. MAIN CONTRIBUTION AL-KINDI

5.1. Overview

This chapter will start with an introduction to al-KindÊ and his background at the time he
lived. Second, we will analyze his treatise in cryptography divided into five sections and
values of his contribution. Third, stating various opinions on al-KindÊ and finally the
conclusion to this chapter.

5.2. Background

Abū-Yūsuf Ya„qūb ibn Isḥāq ibn as-Ṣabbāḥ ibn „Omrān ibn Isma„īl al-Kindī or
simply al-KindÊ was born in Kufa, Iraq, to a royal family, the Kindah. The Kindah is
perceived as the family tree which had originated in southern Arabia. His father was the
governor of Kufa, an official of Haroon al-Rashid and al-Kindi received his preliminary
education there.[13]

Figure 3: Map of Kufa, a city in Iraq.

He later completed his studies in Baghdad, where he was patronized by the


Abbasid Caliphs al-Ma'mun, who reigned from 813 until his death in 833 and al-
Mu'tasim14. Al-Ma‟mun appointed al-KindÊ to House of Wisdom15 in Baghdad, a recently

14
Al-Ma'mun died near Tarsus. He was succeeded by his half-brother, al-Mu'tasim.

18
established centre for the translation of philosophical and scientific texts, because of his
learning and passion for study. He was well known for his beautiful calligraphy, and at
one point was employed as a calligrapher by al-Mutawakkil. Al-Kindi (801–873 CE) is
known to the West as Alkindus and was a well known polymath16, an Islamic
philosopher, scientist, astrologer17, astronomer, cosmologist, chemist, logician,
mathematician, musician, physician, physicist, psychologist, and meteorologist. Al-KindÊ
is also known for being one of the fathers of cryptography. He was the mentor of caliphs,
the owner of "al-Kindiyya" Library, and the director of "bayt al- Íikma" or House of
Wisdom, the greatest known scientific institution in the Arab Islamic civilization at the
time.

18
Figure 4: Bayt al-Hikma, burned second floor view, May 2003

Bayt al-Íikma was completely burned and looted. It is located right next to the
Ministry of Defence. Its collection was about 100 manuscripts but it included a 9th-
century Qur'ān, a 12th-century copy of the Maqāmāt of al-Harīrī, an Ibn Sīnā philosophy
text and a 19th-century manuscript of al-Alūsī concerning Baghdad. This entire collection

15
AL-Ma'mun was a patron of learning and founded an academy called the House of Wisdom where Greek
philosophical and scientific works were translated.
16
A person whose expertise spans a significant number of different subject areas.
17
An astrologer practices one or more forms of astrology.
18
Bayt al-Hikma in http://oi.uchicago.edu/OI/IRAQ/mela/LibraryPix/014.html

19
was lost and there were no microfilms or microfiche copies. It is unclear whether they
were stolen or burnt.

Figure 5: Abu Yousuf Yaqub Ibn Ishaq al-Kindi.

When al-Ma'mun died, his brother, al-Mu'tasim became caliph19. Al-KindÊ's


position was enhanced under al-Mu'tasim, who appointed him as a tutor to his son. Al-
Mu'tasim died in 842 CE and was succeeded by al-Wathiq who, in turn, was succeeded as
Caliph in 847 CE by al-Mutawakkil [14]. But on the accession of al-Wathiq and
especially of al-Mutawakkil, al-Kindi's star faded. Some attributes al-KindÊ's downfall to
scholarly rivalries at the House of Wisdom and others refer to al-Mutawakkil‟s often
violent persecution of unorthodox Muslims at one point al-KindÊ was beaten and his
library temporarily confiscated. Sadly, al-KindÊ died in Baghdad in 873 CE.

After his death, al-Kindi's philosophical works quickly fell into obscurity and many of
them were lost even to later Islamic scholars and historians. This may have occurred for a
number of reasons. Aside from the militant orthodoxy of al-Mutawakkil, the Mongols
destroyed countless libraries during their invasion. Al-KindÊ wrote about 273 works on
various subjects. Most of his works did not survive to this date except for a few Latin
translations.

19
The head of state in a Caliphate, and the title for the leader of the Islamic Ummah, an Islamic community ruled
by the Shari'ah.

20
5.3. Main Contribution of al-KindÊ

Al-KindÊ’s main contribution was in cryptanalysis where his treatise is the oldest
cryptology work found so far by historians. The treatise revealed the basics that ought to
be mastered before embarking upon cryptanalysis. The analysis of al-KindÊ’s treatise on
cryptanalysis is divided into five sections for better understanding.[12]

1) Algorithms of Cryptanalysis.

Al-KindÊ discusses in the first section the principles of cryptanalysis. He lists


three principles related to prose20, which are:
a) The quantitative characteristics of letters or quantitative expedients.
This is done by determining the frequency of occurrence of letters and the
order of letter frequency in a given language. Al-KindÊ explained a method
of deducing this frequency and concluded that the use of this statistical
method is dependent on the length of the text and he also explained how to
use this method.
b) The qualitative characteristics of letters or qualitative expedients.
This is based on the knowledge of the association and dissociation of
letters of the alphabet. Al-KindÊ explained when and how to use this
stratagem21. He then listed the most frequent two-letter words in the
Arabic language, such as and the three-letter words such as
.
c) The probable word or opening statements
Probable word varies according to the language of the text. In Arabic, for
example, the opening statement often used is which is
translated into “in the name of God the Compassionate and the Merciful”.

In the treatise al-Kindi also mentioned the principles for poetry but we are only
interested in ones related to prose.

20
The ordinary form of spoken or written language, without metrical structure, as distinguished from poetry.
21
a cleverly contrived trick or scheme for gaining an end.

21
Quantitative
expedients

Qualitative
Prose
expedients
The principles
of cryptanaysis
Poetry Probable word

22
Figure 6: The principles of cryptanalysis

2) The Major Types of Encipherment.

Al-KindÊ discusses in the second section, the principal types of


encipherment which he probably deduced from the enciphered texts he
studied in his private library or in "bayt al- Íikma". Al-KindÔ encountered
with enciphered texts in some of the books of ancient and contemporary
civilizations. From such texts, he derived a complete methodology for
cryptanalysis.

To explain further, al-KindÊ represented his methods in a tree diagram for


better understanding and easier explanations. Here it shows that al-KindÊ
was very dedicated for accuracy in teaching and explaining. In his treatise,
he says, "Let us represent all these methods in a tree-diagram, so that all
our senses participate in understanding this craft, and facilitate its
comprehension by good assistance of the Almighty and to Him we entrust
our soul".23

22
This figure was referenced from Figure 2.1 in [12] "Arabic Origins of Cryptology: Al –Kindi’s Treatise on
Cryptanalysis." vol. 1, Y. M. A. Mohamad Mrayati, and M.Hassan at-Tayyan, Ed., ed, 2003.
23
Page 142 of the [12] Ibid., ed.

22
Figure 7: This is the full representation of al-KindÊ’s major types of encipherment, pg 87 of the book.[12]

23
Figure 8: The full representation of al-Kindi’s major types of encipherment, pg 87 of the book in Arabic

24
Al-KindÊ classifies the principal methods of encipherment into two major types
1. Simple Encipherment
a. Changing the forms of letters without relationship and diffusion
i. Changing the forms of letters or substitution
It can be done in two ways which is using the same form of
letters as those of the plaintext or changing form of letter
(substitute letter by symbol).
ii. Keeping the forms of letters or transposition.
This is done by changing the position of the letter or simply
without changing the position of the letter.
b. Changing the forms of letters with relationship and diffusion
i. Relationship by species
ii. Relationship by genus
2. Composite Encipherment

Al-KindÊ preferred to keep his book short and in the form of a summary.
He defined composite encipherment by saying: "Composite encipherment
is made up of all aforementioned simple methods. You only have to find
two or more methods of them that can be combined" 24.

3) Algorithms for Cryptanalysing Certain Types of Encipherment.

Al-KindÊ delineated stages for cryptanalysing by turning to the methods he


mentioned right at the beginning of his treatise. His has presented seven
algorithms for cryptanalysing and his presentation is so clear. However,
al-KindÊ did not give names or classified the algorithms but he step-by-
step explained it thoroughly page to page, which is why mentioning them
here would not be trivial.

24
This was mentioned in his treatise p 142

25
4) Arabic Letters: Their Order and Frequency of Occurrence.

In Arabic, the letter “alif” is the most common of all Arabic letters. Other
letters are listed according to the descending order of frequency.

Al-KindÊ recorded the occurrence frequency of each letter from seven


different sheets written in Arabic. For some reason, the scribe in al-

KindÊ‟s treatise missed three letters which are .


This is the arrangement he discovered (from right to left).

Table 4: Al-Kindi's Arabic letter frequency analysis


He concluded that vowels are the most frequent in all languages because
they are the basics subject of speech.[12]

5) Letter Combinations in Arabic.

In this section, al-KindÊ explained concerning combinable and non-


combinable letters in the Arabic language. Non-combinable are basic
letters meaning that they could not be combined with others at all only in
anterior position or posterior only. For example the letter tha (Ï) is
never combinable with the letters and the letter does not
combine with interiorly but it does posteriorly.

26
Figure 9: Scanned image of A photocopy of the first page
Figure 10: Scanned image of the last page of al-KindÊ's
of al-KindÊ's treatise
treatise.

27
5.4. Values of Contribution

It is worth noting that the concept of using the frequency of occurrence of


letters in the language to be cryptanalysed was not introduced in the West until
the fifteenth century, when L.B. Alberti wrote his first treatise on cryptanalysis.25
Many methods of cryptanalysis was created since then and until now.
Crypatanalysis contributed a lot to the military to reveal their hidden messages
and as a strategy against the enemy.
Also his treatise became a reference for the researcher in this field during
a period extending until the middle of the eighth century of the Hegira. ibn
DunaynÊr (d. AH 626/AD 1229), relied heavily upon this treatise in his work
MaqÉÎid al-fuÎËl al-mutarjima ‘an Íall at-tarjama, and so did ibn ad-Durayhim
who benefited from the treatise in his classification of the methods of
encipherment in MiftÉÍ al-kunËz fÊ ÊÌÉÍ al-marmËz.

5.5. Various thoughts on al-KindÊ

The historian Ibn al-Nadim (d. 955), described him as “…the best man of his
time, unique in his knowledge of all the ancient sciences.” 26
The Italian Renaissance scholar Geralomo Cardano (1501–1575) considered him
one of the twelve greatest minds of the Middle Ages.[15]

5.6. Conclusion

The progress of arithmetic and algebra among the Arabs and the use of Arabic
numerals had greatly benefit cryptologist in their work. Cryptanalysis most probably
would have not existed without this advancement. Al-KindÊ for example has left us with
his treatise RisÉla fÊ ÑistiÍrÉj al-Ña‘dÉd al-mudmara27 or translated as A Manuscript on
Finding out Hidden Numbers which contains detailed discussions on statistics, Arabic
phonetics and Arabic syntax and as well as describing the system of cryptanalysis.

25
The Codebreaker; David Kahn; 1996; p 127
26
"Al-Kindi, Encyclopaedic Scholar of the Baghdad 'House of Wisdom'" (HTML). Retrieved on 2010-08-12.
27
A copy of the treatise is held at Aya Sofia Library under number 4830. It consists of 11 pages

28
6. APPLICATIONS OF FREQUENCY ANALYSIS

6.1. Overview

In this chapter, frequency analysis was carried out to prove the theory of al-KindÊ. Next,
a decipherment was done using frequency analysis to reveal a hidden text encrypted
using a simple transposition method. Finally is the conclusion of this part.

6.2. Applying Frequency Analysis Method

As mentioned above, Al-KindÊ recorded the occurrence frequency of each letter from
seven different sheets written in Arabic. Chiefly, the Arabic alphabet consists of 28
primary letters, but for some reason, the scribe in al-KindÊ‟s treatise missed three letters

which are . According to the arrangement he discovered, a graph


was plot to show the occurrence of each letter starting from most common letter and
decrementing.

0.18
0.16
frequency of occurence
0.14
0.12
0.1
0.08
0.06
0.04
0.02
0
‫ا‬ ‫م ل‬ ‫ه‬ ‫غ ظ ط ث خ ص ذ ج ح ق س د ك ب ت ف ع ر ن ي و‬

Figure 11: Al-Kindi's Arabic letter frequency analysis.

The first implementation of al- Kindi‟s theory was done on surah28 al-baqarah, the
longest surah with 286 ayah29 from the holy al-QurÉn. The Quran text was taken from
the book of Quran from tanzil.info.30 Below is a snapshot image showing how the

28
Surah, Arabic: ‫ سىرة‬sūrah, is a chapter of the Qur'an. There are 114 surah in the Qur'an.
29
refers to a verse of the QurÉn
30
Download QurÉn text from http://tanzil.info/download

29
preferences are set using the lists and checkboxes provided therein, together with an
explicit description of such choices and steps taken to prepare the download file for
analysis.

Figure 12: Quran text was taken from the book of Quran from tanzil.info

Then after downloading the text file, the surah al-baqarah text is copied and pasted in the
interface of Intellyze31 3.0. Intellyze 3.0 will then analyze the text and calculates
frequency of Arabic letters.

Figure 13: Screenshot of the use of Intellyze 3.0 Trial edition of surah al-baqarah.

31
It is Intellaren's Arabic letter and word frequency analyzer developed in 2010. Intellaren is an emerging company
based in Toronto, Canada.

30
The results are as follows.

0.18

0.16 al-baqarah

0.14

0.12

0.1

0.08

0.06

0.04

0.02

0
‫ا‬ ‫ل‬ ‫م‬ ‫ه‬ ‫ن ي و‬ ‫ر‬ ‫ك ب ت ف ع‬ ‫ج ح ق س د‬ ‫غ ظ ط ث خ ص ذ‬

Figure 14: Comparison of frequency analysis of al-baqarah and al-kindi's treatise.

The results show that the frequencies are similar but the letter ha, waw and nun shows a
relative difference. This may be the fact that al-Kindi‟s frequency analysis was only
based on seven different sheets written in Arabic according to [12]. Thus, the average
shows that the letter frequencies are similar thus could be use to in cryptanalysis.

Figure 15: Values of relative difference in letters ha and nun.

31
The second implementation was on a random article entitled

“ ‫االجتهاد‬ ‫ آثار فقدان آداب االختالف في‬:‫”المبحث الخامس‬


containing 1170 words or approximately four pages long. It went through the same
process of frequency analysis as surah al-baqarah and the results are as follows.

0.2
0.18
al-kindi
0.16
0.14
0.12
0.1
0.08
0.06
0.04
0.02
0
‫ا‬ ‫ل‬ ‫م‬ ‫ه‬ ‫ن ي و‬ ‫ر‬ ‫ك ب ت ف ع‬ ‫ج ح ق س د‬ ‫غ ظ ط ث خ ص ذ‬

Figure 16: Comparison of frequency analysis of an arabic article and al-kindi's treatise

Again the letter ha and waw have a relative difference but overall it fits the frequency
analysis. In another comparative study done by Intellaren to compare the frequency of
letters found in the Quran to general other sources. Data sources include:

 The Quran. Data are downloaded from tanzil.info.

 Others. Sources here are gathered from:


o The first seven volumes of the series ‫( وال نهاي ت ال بداي ت‬The Beginning and The
End) of Ibn Katheer. All together, these seven volumes fill up 2,855 pages,
containing 1,096,047 words, containing 4,326,031 letters.
o The book of sirah of ‫( ال مخ تىم ال رح يق‬The Sealed Nectar; sirah means the life
of Prophet Mohammad ‫ )و س لن ع ل يه هللا ص لى‬of Almubarakfuri. The book is
spread over 284 pages, containing 134,662 words, containing 553,740 letters.

32
o The book of ‫( ال عروس ت ح فت‬The Masterpiece for the Bride) for Al-shuri. The
book is spread over 239 pages, containing 66,550 words, containing 242,361
letters.
Collectively, these sources add up to 3,378 pages, generating 1,297,259 words, or,
5,122,132 letters. The comparison is compiled in a graph as follows:

32
Figure 17: Comparison of frequency analysis of the Quran to other Arabic text.

The results showed that the comparison is small and it proves that Arabic language have
a certain typical frequency analysis independent of its sources that can be used to encrypt
as done by al-Kindi.

32
Intellaren comparative study of Arabic letter frequency in http://www.intellaren.com/articles/en/comparative-
frequency-analysis-of-arabic-texts

33
Al-Kindi‟s discovery which is now known as frequency analysis is as applicable to
English as it is to Arabic.

Figure 18: Letter frequency in English.

This bar chart in Figure 11, shows how often each letter of the alphabet appears in
virtually all English writing. For example, „x‟ and „z‟ appear less than 1% of the time as
compared to the letter„t‟ which appears 9.1% of the time. Moreover, letter „e‟, the
commonest letter of all, appears 12.7% of the time. To show how universal this law is, a
frequency analysis was done on Hamlets‟ famous soliloquy entitled "To be or Not To
Be", a monologue from the play by William Shakespeare. Below is a copy of the
original script of Hamlet by William Shakespeare.

Figure 19: Hamlet's famous lines, written in Early Modern English by Shakespeare.[16]

34
The result showed that the letter frequency fits the pattern almost exactly when
compared to the standard in figure 14 above.

To Be Or Not To Be Frequency Analysis


160
140
120
100
80
Series1
60
40
20
0
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Figure 20: “To be or not To Be” frequency Analysis

A different frequency analysis of a recent newspaper article from The Star, entitled
“AirAsia X tickets to Tokyo from next week” was done for comparison. The scanned
image of the article was converted from image to a Microsoft document, text, using an
online converter33 and the letters were automatically calculated and presented in
percentage also using a free online tool.34 The results are as follows.

33
Online Document Conversion in http://www.onlinedocumentconversion.com/
34
Count Letters and Symbols in a Text in http://www.amstat.org/publications/jse/secure/v7n2/count-char.cfm

35
250

200 FREQUENCY
LETTER
150

100

50

0
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Figure 21: The News article letter frequency.

It too fits the prediction and this proves that Shakespeare and The Star used each letter
of the alphabet in the similar proportions but they just arranged it differently.

0.14
The Star News Article
0.12
General English letter frequency
0.1

0.08

0.06

0.04

0.02

0
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Figure 22: Comparison with the general English Letter frequency.

Another test was done using frequency analysis to decipher an encrypted text. The text
35
was randomly encrypted using simple transposition method available online.
Comparing with the English letter frequency we can already make some sense of what

35
Count Letters and Symbols in a Text in http://www.amstat.org/publications/jse/secure/v7n2/count-
char.cfm

36
the message says. For example, the letter„T‟, a blank space and letter „E‟. The blank
probably represents the letter „H‟ to represent the word „THE‟ (in green of figure 13)
which is the most common three letter word in English. And with more analysis and
guessing the cipher will be able to be revealed. Thus this breaks the code, hence,
cryptanalysis.

Figure 23: The encrypted message, deciphered.

The deciphered message turned out to be:

EXECUTION BEFORE TAKES PLACE

DURING FRIDAYS THERE

BUT NOW HAS BEEN MOVED NEAR TO THE JUFFALI MOSQUE

THIS MASJID IS AT THE RIGHT OF THE

NEAR ROUND ABOUT

JUST BEFORE THE RED PALACE SEA HOTEL

37
Rank Character Frequency Percent Rank Character Frequency Percent
1 | 29 15.34% 1 !hK 5 2.65%
2 K 24 12.70% 2 |!h 5 2.65%
3 ! 15 7.94% 3 hK| 3 1.59%
4 c 13 6.88% 4 |)K 3 1.59%
5 G 11 5.82% 5 c(K 2 1.06%
6 P 10 5.29% 6 fc( 2 1.06%
7 1 9 4.76% 7 |\G 2 1.06%
8 h 9 4.76% 8 PK| 2 1.06%
9 / 8 4.23% 9 K|! 2 1.06%
10 ? 8 4.23% 10 GPK 2 1.06%
11 0 7 3.70% 11 )Kq 2 1.06%
12 # 6 3.17% 12 KqG 2 1.06%
14 q 6 3.17% 13 cP| 2 1.06%
15 ) 5 2.65% 14 K|P 2 1.06%
16 f 4 2.12% 15 K#| 2 1.06%
17 \ 3 1.59% 16 /1| 2 1.06%
18 " 3 1.59% 17 0Kc 2 1.06%
19 ( 3 1.59% 18 qGP 2 1.06%
20 d 2 1.06% 19 KcP 2 1.06%
21 H 2 1.06% 20 /0d 1 0.53%
22 , 1 0.53% 21 |/1 1 0.53%
23 y 1 0.53% 23 |1K 1 0.53%
24 . 1 0.53% 24 !h/ 1 0.53%
25 O 1 0.53% 25 cR1 1 0.53%
26 R 1 0.53% 26 |PK 1 0.53%
27 U 1 0.53% 27 #|0 1 0.53%
Figure 24: The total count of single characters in the text 28 G.| 1 0.53%
is n=189 29 K|1 1 0.53%
30 #|H 1 0.53%
Figure 25: The total count of triplets of characters in the
text is n=18

6.3. Conclusion

In conclusion, cryptology was born by al-KindÊ‟s discovery. It is both proven practical


and universal. The tests done showed that frequency analysis is crucial in cryptanalysis.
It shows that at that time, al-KindÊ made a huge discovery without the use of computers
to help him type, software to cut down the computational needs of years to few
milliseconds or Internet to help him surf through the intelligence and cultivation of
others. He is truly a genius scientist that knows what he is experimenting about.

38
7. CONCLUSION

In conclusion, we achieved our objectives of this project which are

 To obtain background knowledge on Muslim‟s contribution in cryptography.


 To review relative works and main contribution in cryptography.
 To implement al-Kindi‟s frequency analysis method.
 To enhance and improve knowledge on Muslim scientists.
 To learn from the history and to take lessons from it.

Also, al-KindÊ was a very pious man. In his treatise he included Islamic ethics and values.
For example in his treatise introduction, “….Praised be Allah SWT that made you a reason
for helping people to one of the great, and yet neglected benefits. I pray Him that He
consummately invest you with all good qualities, help you in your intentions, grant you
success to achieve your aims, and guide your steps to prosperity in both your worldly
existence and the life to come.” There are many more of these.

Al-KindÊ was able to describe Cryptanalysis within two sentences[12] of his greatest treatise
entitled "A Manuscript on Deciphering Cryptographic Messages" and it reads:

"One way to solve an encrypted message, if we know its language, is to find a different
plaintext of the same language long enough to fill one sheet or so, and then we count the
occurrences of each letter. We call the most frequently occurring letter the ‘first', the next
most occurring letter the ‘second', the following most occurring the ‘third', and so on, until
we account for all the different letters in the plaintext sample".

"Then we look at the cipher text we want to solve and we also classify its symbols. We find
the most occurring symbol and change it to the form of the ‘first' letter of the plaintext
sample, the next most common symbol is changed to the form of the ‘second' letter, and so
on, until we account for all symbols of the cryptogram we want to solve".

Abū-Yūsuf Ya„qūb ibn Isḥāq al-Kindī

39
8. REFERENCES

[1] D. Kahn, "The codebreakers: the story of secret writing," ed: Scibner, 1996.
[2] K. E. Swartley, Encountering the World of Islam: Authentic Media, 2005.
[3] I. A. Al-Kadi, "“Cryptography and Data Security: Cryptographic Properties of Arabic”," Third Saudi
Engineering Conference. Riyadh, Saudi Arabia, vol. 2, pp. 910-921, 1991.
[4] W. Stallings, Cryptography and Network Security Principles and Practices
4ed.: Prentice Hall, 2005.
[5] E.Cole, "Hiding In Plain Sight," C. Long, Ed., ed Indianapolis, Indiana: Wiley Publishing, Inc., 2003.
[6] Auguste Kerckhoffs. Available: http://en.wikipedia.org/wiki/Auguste_Kerckhoffs
[7] Claude Shannon. Available: http://en.wikipedia.org/wiki/Claude_Shannon
[8] I. A. Al-Kadi, "Origins of cryptology: the Arab contribution," in Selections from Cryptologia:
history, people, and technology, ed: Artech House, Inc., 1998, pp. 93-122.
[9] E. Shouby, "The Influence of the Arabic Language on the Psychology of the Arabs," Middle East
Journal, vol. 5, p. 19, 1951.
[10] A. G. Chejne, The Arabic language: Its Role in Hostory, 1969.
[11] Y. M. Faruqi, "Contributions of Islamic scholars to the scientific enterprise," International
Education Journal, vol. 7, pp. 391-399, 2006.
[12] "Arabic Origins of Cryptology: Al –Kindi’s Treatise on Cryptanalysis." vol. 1, Y. M. A. Mohamad
Mrayati, and M.Hassan at-Tayyan, Ed., ed, 2003.
[13] N. Ahmad. (2009, Yaqub Ibn Ishaq al-Kindi Available: http://love-
mathematics.blogspot.com/2009/10/yaqub-ibn-ishaq-al-kindi.html
[14] AL- Kindi in History. Available: http://www.alkindipharma.com/ReadMain.php?id=2
[15] M. Fairouz, "Title," unpublished|.
[16] (2006, A short history of the origins and development of the English language. Available:
http://www.esldepot.com/page.php?xPage=free-esl-history-english.html

40