Instant Download Understanding Cryptography From Established Symmetric and Asymmetric Ciphers To Post Quantum Algorithms 2nd Edition Christof Paar - Jan Pelzl - Tim Güneysu PDF All Chapter
Instant Download Understanding Cryptography From Established Symmetric and Asymmetric Ciphers To Post Quantum Algorithms 2nd Edition Christof Paar - Jan Pelzl - Tim Güneysu PDF All Chapter
Instant Download Understanding Cryptography From Established Symmetric and Asymmetric Ciphers To Post Quantum Algorithms 2nd Edition Christof Paar - Jan Pelzl - Tim Güneysu PDF All Chapter
com
OR CLICK BUTTON
DOWLOAD NOW
https://ebookname.com/product/focus-on-grammar-2-workbook-a2-4th-
edition-samuela-eckstut-didier/
https://ebookname.com/product/collins-get-ready-for-ielts-
listening-pre-intermediate-a2-1st-edition-jane-short/
https://ebookname.com/product/the-swan-system-of-the-c2-molecule-
john-g-phillips/
https://ebookname.com/product/devil-in-the-milk-illness-health-
and-the-politics-of-a1-and-a2-milk-keith-woodford/
Specification for thermal spray feedstock wire and rods
2nd Edition Edition American Welding Society. C2
Committee On Thermal Spray.
https://ebookname.com/product/specification-for-thermal-spray-
feedstock-wire-and-rods-2nd-edition-edition-american-welding-
society-c2-committee-on-thermal-spray/
https://ebookname.com/product/fighting-the-anti-sicilians-
combating-2-c3-the-closed-the-morra-gambit-and-other-tricky-
ideas-everyman-chess-1st-edition-richard-palliser/
https://ebookname.com/product/ac-dc-first-edition-phil-sutcliffe/
https://ebookname.com/product/royal-marine-commando-1950-82-will-
fowler/
https://ebookname.com/product/ac-electrokinetic-colloids-and-
nanoparticles-1st-edition-hywel-morgan/
Christof Paar · Jan Pelzl · Tim Güneysu
Understanding
Cryptography
From Established Symmetric
and Asymmetric Ciphers
to Post-Quantum Algorithms
Second Edition
Understanding Cryptography
Christof Paar • Jan Pelzl • Tim Güneysu
Understanding Cryptography
From Established Symmetric and Asymmetric
Ciphers to Post-Quantum Algorithms
Second Edition
Christof Paar Jan Pelzl
Max Planck Institute Hamm-Lippstadt University
for Security and Privacy of Applied Sciences
Bochum, Germany Hamm, Germany
Tim Güneysu
Ruhr University Bochum
Bochum, Germany
This Springer imprint is published by the registered company Springer-Verlag GmbH, DE, part of
Springer Nature.
The registered company address is: Heidelberger Platz 3, 14197 Berlin, Germany
vii
viii Foreword
has converged on possible standards based on three particular hard problems; this
textbook covers all three approaches. Indeed, this textbook may be the first to cover
PQC (post-quantum cryptography).
This textbook also has updated material on “conventional” (non-public-key)
cryptography. For example, it includes new and/or updated material on crypto-
graphic hash functions (including coverage of SHA-2 and SHA-3), stream ciphers
(including Salsa20 and ChaCha), and modes of operation (including authenticated
encryption modes).
In summary, I recommend this book highly for both undergraduate and graduate
classroom use; it can easily be augmented for students with a more theoretical ori-
entation. This book is also recommended for self-study, for anyone who wishes to
bring themselves up-to-date on where this exciting field is going.
Content Overview
The book has many features that make it a unique source for students, practition-
ers and researchers. We focus on practical relevance by introducing the majority
of cryptographic algorithms that are used in modern real-world applications. With
respect to symmetric algorithms, we introduce the block ciphers AES, DES and
ix
x Preface
What’s New
The second edition has received major updates and has grown from the 350 pages
of the first edition to more than 500 pages. The most noticeable new material is the
extensive treatment of post-quantum cryptography, or PQC, in Chapter 12. In the
coming years, many applications will need to replace traditional public-key schemes
with PQC algorithms. This will be the most comprehensive change in the landscape
of cryptography that we have seen in decades. We hope that our introduction to the
three most promising PQC families, that is lattice-based, code-based and hash-based
schemes, will be helpful in this context. Beside PQC, the 2nd edition also covers the
SHA-2 and SHA-3 hash functions, the new stream ciphers Salsa20 and ChaCha,
and authenticated encryption. Throughout the book, security parameters and
related work have been updated, as well as the Discussion and Further Reading
sections that conclude each chapter. The problem sections of all 14 chapters have
been extended, too.
The material in this book has evolved over many years and is “classroom proven”.
We’ve taught it both as a course for advanced undergraduate students and gradu-
ate students in computer science/math/electrical engineering, as well as a first-year
undergraduate course for students majoring in our IT security program. We found
that one can teach most concepts introduced in the book in a two-semester course,
with 90 minutes of lecture time plus 90 minutes of help sessions with exercises per
week (total of 10 ECTS credits). In a typical US-style three-credit course, or in a
one-semester European course, some of the material should be omitted. Here are
some reasonable choices for a one-semester course:
Course Curriculum 1 Focus on the application of cryptography, e.g., in an applied
course in computer science or a basic course for subsequent security classes, e.g., in
a cybersecurity program. A possible curriculum is: Chap. 1; Sects. 2.1–2.2; Chap. 4;
Sect. 5.1; Chap. 6; Sects. 7.1–7.3; Sects. 8.1–8.3; Sects. 10.1–10.2; Sects. 11.1–11.3;
Sects. 12.1 & 12.4; Sect. 13.1; Sects. 14.1–14.3.
Preface xi
More Information
There are two online sources related to this book that we can recommend. First,
we recorded the two-semester introductory cryptography course that we teach at
Ruhr University Bochum (RUB). The main audience for this class are the first-
year students of RUB‘s IT Security program, and we tried to make the material as
accessible as possible. More than 20 lectures are available on the YouTube channel
“Introduction to Cryptography by Christof Paar”:
https://www.crypto-textbook.com/video
Each lecture takes about 80–90 minutes and closely follows the material in the book.
(For the more adventurous reader, there is also a German-language set of videos
available in the YouTube channel “Einführung in die Kryptographie von Christof
Paar”.)
Second, we recommend the companion website for the book, containing slide
sets for lecturers and solutions to odd-numbers problems of the book:
https://www.crypto-textbook.com
Writing this book would have been impossible without the help of many people. We
hope we did not forget anyone in our listing.
Help with technical questions was provided by Frederick Armknecht (stream ci-
phers), Roberto Avanzi (finite fields and elliptic curves), Eike Kiltz (provable secu-
rity), Gregor Leander (block ciphers), Alex May (number theory), Alfred Menezes
and Neal Koblitz (history of elliptic curve cryptography), Matt Robshaw (AES) and
Damian Weber (discrete logarithms). We are particular grateful to Axel Poschmann
who provided the inital section about the PRESENT block cipher.
We would also like to thank Conny Robrahn who worked tirelessly on the more
than 130 figures in this book. Special thanks for proofreading and the many sugges-
tions for improving the material in the second edition go the members of the Embed-
ded Security group at the Max Planck Institute for Security and Privacy, Bochum,
and the Security Engineering group at Ruhr University Bochum: Nils Albartus, Sven
Argo, Steffen Becker, Fabian Buschkowski, Maik Ender, Jakob Feldtkeller, Anna
Guinet, Dina Hesse, Simon Klix, Elisabeth Krahmer, Markus Krausz, Georg Land,
Johannes Mono, Endres Puschner, Jan Richter-Brockmann, Julian Speith, Paul Staat
and Jan Thoma.
For the first edition, we are indebted to the members of the Embedded Secu-
rity group at Ruhr University Bochum — Andrey Bogdanov, Benedikt Driessen,
Thomas Eisenbarth, Stefan Heyse, Markus Kasper, Timo Kasper, Amir Moradi and
Daehyun Strobel — who did much of the technical proofreading and provided nu-
merous suggestions for improving the presentation of the material.
We would like to express our deepest gratitude to Ron Rivest for his willing-
ness to provide the foreword. We’d like to thank the people from Springer for their
continuous support and encouragement. In particular, thanks to our editors Ronan
Nugent and Wayne Wheeler as well as to Michela Castrica.
Last but not least we would like to thank all the readers of the first edition who
provided valuable feedback regarding improving the text and the problem sets.
xiii
Table of Contents
2 Stream Ciphers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.1.1 Stream Ciphers vs. Block Ciphers . . . . . . . . . . . . . . . . . . . . . . 38
2.1.2 Encryption and Decryption with Stream Ciphers . . . . . . . . . . 40
2.2 Random Numbers and an Unbreakable Stream Cipher . . . . . . . . . . . . 43
2.2.1 Random Number Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.2.2 The One-Time Pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.2.3 Towards Practical Stream Ciphers . . . . . . . . . . . . . . . . . . . . . . 46
2.3 Shift Register-Based Stream Ciphers . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.3.1 Linear Feedback Shift Registers (LFSRs) . . . . . . . . . . . . . . . . 50
2.3.2 Known-Plaintext Attack Against Single LFSRs . . . . . . . . . . . 53
2.4 Practical Stream Ciphers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.4.1 Salsa20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.4.2 ChaCha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
xv
xvi Table of Contents
2.4.3 Trivium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.5 Discussion and Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
2.6 Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Chapter 1
Introduction to Cryptography and Data Security
This section will introduce the most important terms of modern cryptology and will
teach an important lesson about proprietary vs. openly known algorithms. We will
also introduce modular arithmetic, which is useful for historical ciphers and of major
importance in modern public-key cryptography.
In this chapter you will learn:
The general rules of cryptography
Key lengths for short-, medium- and long-term security
The different ways of attacking ciphers
A few historical ciphers and on the way we will learn about modular arithmetic
Why one should only use well-established cryptographic algorithms
© The Editor(s) (if applicable) and The Author(s), under exclusive license 1
to Springer-Verlag GmbH, DE, part of Springer Nature 2024
C. Paar et al., Understanding Cryptography, https://doi.org/10.1007/978-3-662-69007-9_1
2 1 Introduction to Cryptography and Data Security
Fig. 1.1 The German Enigma encryption machine (reproduced with permission of
the Deutsches Museum, Munich)
instance, there are documented cases of secret writing in ancient Greece, namely the
scytale of Sparta (Figure 1.2), or the famous Caesar cipher in ancient Rome, about
which we will learn later in this chapter. This book, however, strongly focuses on
modern cryptographic methods and also teaches many data security issues and their
relationship with cryptography.
Let’s now have a look at the field of cryptography, shown in Figure 1.3. The first
thing that we notice is that the most general term is cryptology and not cryptography.
Cryptology splits into two main branches:
Cryptography is the science of securing communication against an adversary.
Historically, the main goal of crypography was to hide the meaning of a message.
Today, however, cryptography is also used for many other security goals such as
the integrity and authenticity of messages.
Cryptanalysis is the science and sometimes art of breaking cryptosystems. You
might think that code breaking is for the intelligence community or perhaps or-
ganized crime, and should not be included in a serious classification of a sci-
entific discipline. However, most cryptanalysis nowadays is done by respectable
4 1 Introduction to Cryptography and Data Security
This section deals with the concept of symmetric ciphers and introduces the historic
substitution cipher. Using the substitution cipher as an example, we will learn the
difference between brute-force and analytical attacks.
1.2.1 Basics
process of encryption (Figure 1.5). What is the advantage? If we have a strong en-
cryption algorithm, the ciphertext will look like random bits and Oscar will not be
able to obtain any useful information from it.
however, that the algorithm is used correctly. Especially, we have to ensure that
an attacker does not get hold of the key. Of course, once Oscar knows the key, he
can easily decrypt the message since the algorithm is publicly known.
Hence it is crucial to note that the problem of transmitting a message se-
curely is reduced to the problems of transmitting a key secretly and of stor-
ing the key in a secure fashion.
2. In this scenario we only consider the problem of confidentiality, that is, of hiding
the contents of the message from an eavesdropper. We will see later in this book
that there are many other things we can do with cryptography, such as preventing
Oscar from making unnoticed changes to the message (message integrity) or
ensuring that a message really comes from Alice (sender authentication).
We will now learn one of the simplest methods for encrypting text, the substitution
(= replacement) cipher. Historically this type of cipher has been widely used, and
it is a good illustration of basic cryptography. We will use the substitution cipher
for learning some important facts about key lengths and about different ways of
attacking cryptographic algorithms.
The goal of the substitution cipher is the encryption of text (as opposed to bits
in modern digital systems). The idea is very simple: We substitute each letter of the
alphabet with another one.
Example 1.1.
Plaintext Ciphertext
A→k
B→d
C→w
···
This does not seem to make too much sense and looks like decent cryptography.
However, the substitution cipher is not secure at all! Let’s look at ways of breaking
the cipher.
Brute-force attacks treat the cipher as a black box. They are based on a simple con-
cept: Oscar, the attacker, has the ciphertext from eavesdropping on the channel and
happens to have a short piece of plaintext, e.g., the header of a file that was en-
crypted. Oscar now simply decrypts the first piece of ciphertext with all possible
keys. Again, the key for this cipher is the substitution table. If the resulting plaintext
matches the short piece of plaintext, he knows that he has found the correct key.
In practice, a brute-force attack can be more complicated because incorrect keys can
give false positive results. We will address this issue in Section 5.2.
It is important to note that a brute-force attack against symmetric ciphers is al-
ways possible in principle. Whether it is feasible in practice depends on the key
space, i.e., on the number of possible keys that exist for a given cipher. If testing all
the keys on many modern computers takes too much time, i.e., hundreds or thou-
sands of years, the cipher is computationally secure against a brute-force attack.
More on computational security will be said in Section 2.2.3.
Let’s determine the key space of the substitution cipher: When choosing the re-
placement for the first letter A, we randomly choose one letter from the 26 letters of
the alphabet (in the example above we chose k). The replacement for the next al-
phabet letter B was randomly chosen from the remaining 25 letters, etc. Thus there
exist the following number of different substitution tables:
That means the key space has roughly a size of 288 , which is equal to the key space
of a cipher that has a key consisting of 88 bits. Even with hundreds of thousands of
high-end PCs such a search would take several decades! Thus, we are tempted to
1.2 Symmetric Cryptography 9
conclude that the substitution cipher is secure. But this is incorrect because there is
another, more powerful, attack, which will be described in the following.
First we note that the brute-force attack from above treats the cipher as a black box,
i.e., we do not analyze the internal structure of the cipher. The substitution cipher
can easily be broken by such an analytical attack.
The major weakness of the cipher is that each plaintext symbol always maps to
the same ciphertext symbol. That means that the statistical properties of the plaintext
are preserved in the ciphertext. If we go back to the second example we observe that
the letter q occurs most frequently in the text. From this we know that q must be
the substitution for one of the frequent letters in the English language. For practical
attacks, the following properties of language can be exploited:
1. Determine the frequency of every ciphertext letter. The frequency distribution,
usually quite stable even for relatively short pieces of encrypted text, will be
close to that of the given language in general. In particular, the most frequent
letters can often easily be spotted in ciphertexts. For instance, in English E is the
most frequent letter (about 13%), T is the second most frequent letter (about 9%),
A is the third most frequent letter (about 8%), and so on. Table 1.1 lists the letter
frequency distribution of English.
such as THE, AND, etc. Once we have identified one of these words, we imme-
diately know three letters (or whatever the length of the word is) for the entire
text.
In practice, the three techniques listed above are often combined to break substi-
tution ciphers.
Example 1.3. If we analyze the encrypted text from Example 1.2, we obtain:
WE WILL MEET IN THE MIDDLE OF THE LIBRARY AT NOON
ALL ARRANGEMENTS ARE MADE
Lesson learned Good ciphers should hide the statistical properties of the encrypted
plaintext. The ciphertext symbols should appear to be random. Also, a large key
space alone is not sufficient for a strong encryption function.
1.3 Cryptanalysis
This section deals with recommended key lengths of symmetric ciphers and differ-
ent ways of attacking cryptographic algorithms. It is stressed that a cipher should be
secure even if the attacker knows the details of the algorithm.
If we ask someone with some technical background what breaking ciphers is about,
he/she will most likely say that code breaking has to do with heavy mathematics,
smart people and large computers. We have images in mind of the British code
breakers during World War II, attacking the German Enigma cipher with extremely
smart mathematicians (the famous computer scientist Alan Turing headed the ef-
forts) and room-sized electro-mechanical computers. However, in practice there are
also other methods for code breaking. For a secure cryptosystem, it is important (1)
to use sound cryptographic algorithms and protocols and (2) to use correct imple-
mentations of the algorithms. Let’s look at different ways of breaking cryptosystems
in the real world shown in Figure 1.6.
Classical Cryptanalysis
Classical cryptanalysis attempts to break a cipher by analyzing the inputs and out-
puts. We recall from the earlier discussion that cryptanalysis can be divided into
analytical attacks, which exploit the internal structure of the encryption method,
1.3 Cryptanalysis 11
and brute-force attacks, which treat the encryption algorithm as a black box and test
all possible keys. The specific goal of the adversary can vary but in most cases Oscar
attempts to recover the plaintext x from the ciphertext y or he attempts to recover
the key k from the ciphertext y. Especially for analytical attacks it is helpful to look
at what information the opponent has in addition to the ciphertext. The main classes
of attacks are:
Ciphertext-only attack: The adversary has only access to the ciphertext.
Known-plaintext attack: In addition to the ciphertext, the adversary also knows
some pieces of the plaintext (e.g., header information of an encrypted file or
email).
Chosen-plaintext attack: The adversary can choose the plaintext that is being en-
crypted and also has access to the corresponding ciphertext. This can for instance
be the case when he has access to a decryption device such as a smart card and
he attempts to recover the secret key.
Chosen-ciphertext attack: The adversary can choose ciphertexts and also obtains
the corresponding plaintexts. Again, the goal is typically to recover the secret
key.
This list is not exhaustive; additional attacks include adaptive chosen-plaintext and
adaptive chosen-ciphertext attacks or the related-key attack.
Implementation Attacks
Side-channel analysis can be used to extract a secret key by observing the behavior
of a cryptographic implementation, e.g., an integrated circuit or a piece of software.
One family of attacks uses the electrical power consumption or electromagnetic ra-
diation of the CPU that computes the cryptographic algorithms as sidechannels. The
attacker records the power or electromagnetic traces and applies signal processing
techniques to recover the key. Related attacks are based on timing side-channels, in
which the adversary measures the run time behavior of a cryptographic implemen-
12 1 Introduction to Cryptography and Data Security
tation and attempts to compute the key from the timing measurements. All of these
attacks are mainly used against devices to which an attacker has physical access
such as smart cards, smartphones or IoT devices.2
Another family of attacks exploits software side-channels. They are primarily
relevant if different processes are running on a computer, e.g., in cloud computing.
The assumption is that the adversary controls one process with which he is able to
learn secret values such as cryptographic keys from another process. To gain infor-
mation, the hostile process exploits effects such as timing behavior or cache access
patterns. A main mechanism for preventing software side-channels is to ensure that
cryptographic implementations have a constant run time, independent of any secret
value.
Even though both implementation attacks and social engineering attacks can be
quite powerful in practice, this book mainly assumes attacks based on mathematical
cryptanalysis and brute-force attacks.
We note that the list of attacks against cryptographic systems is certainly not
exhaustive. For instance, malware on a computer can also reveal secret keys in
software systems. You might think that many of these attacks, especially social
engineering and implementation attacks, are “unfair” but there is little fairness in
real-world cryptography. If people want to break your IT system, they are already
breaking the rules and are, thus, unfair. The major point to learn here is:
An attacker always looks for the weakest link in your cryptosystem. That
means we have to choose strong algorithms and we have to make sure that all
other attacks such as social engineering and implementation attacks are not
feasible.
Solid cryptosystems should adhere to Kerckhoffs’ Principle, postulated by Au-
guste Kerckhoffs in 1883.
2 Note that most modern hardware tokens that are security sensitive, such as smart cards used for
payment, have built-in countermeasures against sidechannel attacks and are very hard to break.
1.3 Cryptanalysis 13
Some background information on the principle can be found in the Further Reading,
Section 1.5.
Important Remark: Kerckhoffs’ Principle is counterintuitive! It is extremely
tempting to design a system that appears to be more secure because we keep the de-
tails hidden. This is called security by obscurity. However, experience and military
history has shown over time that such systems are almost always weak, and they are
very often broken easily as soon as the secret design has been reverse-engineered or
leaked out through other means. An instructive case study for this is the attack on
Mifare chipcards. This type of chipcard had been used millionfold in applications
for contactless payment, e.g., in the original Oyster card used for London’s public
transportation system. Its security was based on a cipher which was kept secret. This
worked “well” for several years. However, after reverse-engineering the cipher, re-
searchers quickly found several ways of attacking the algorithm, both with classical
cryptanalysis and implementation attacks. This lead to severe security problems for
the real-world systems that were based on Mifare. For this reason, cryptographic
algorithms must provide security even if an attacker gets to known to all internal
details except for the key.
During the 1990s there was much public discussion about the key length of ciphers.
Before we provide some guidelines, there are two crucial aspects to remember:
1. The discussion of key lengths for symmetric cryptographic algorithms is only rel-
evant if a brute-force attack is the best known attack. As we saw in Section 1.2.2
during the security analysis of the substitution cipher, if there is an analytical
attack that works, a large key space does not help at all. Of course, if there is the
possibility of social engineering or implementation attacks, a long key also does
not help.
2. The key lengths for symmetric and asymmetric algorithms are dramatically dif-
ferent. For instance, a 128-bit symmetric key provides roughly the same security
as a 3072-bit RSA (RSA is a popular asymmetric algorithm) key.
Both facts are often misunderstood, especially in the semitechnical literature.
Table 1.2 gives a rough indication of the security of symmetric ciphers with re-
spect to brute-force attacks. As described in Section 1.2.2, a large key space is a nec-
essary but not sufficient condition for a secure symmetric cipher. The cipher must
14 1 Introduction to Cryptography and Data Security
also be strong against analytical attacks. The table mentions quantum computers.
Table 1.2 Estimated time for successful brute-force attacks on symmetric cipher
with different key lengths
The role that they play for the cryptanalysis of symmetric ciphers is discussed in
Section 12.1.1.
Foretelling the Future Of course, predicting the future tends to be tricky: We can-
not really foresee new technical or theoretical developments with certainty. As you
can imagine, it is very hard to know what kinds of computers will be available in the
year 2050. For medium-term predictions, Moore’s Law is often assumed. Roughly
speaking, Moore’s Law states that computing power doubles every 18 months3
while the costs stay constant. This has the following implications in cryptography:
If today we need one month and computers worth $1,000,000 to break a cipher X,
then:
The cost for breaking the cipher will be $500,000 in 18 months (since we only
have to buy half as many computers),
$250,000 in 3 years,
$125,000 in 4.5 years, and so on.
It is important to stress that Moore’s law is an exponential function. In 15 years,
i.e., after 10 iterations of computer power doubling, we can do 210 = 1024 times
as many computations for the same money we would need to spend today. Stated
differently, we only need to spend about 1/1000th of today’s money to do the same
computation. In the example above that means that we can break cipher X in 15
years within one month at a cost of about $1, 000, 000/1024 ≈ $1000. Alternatively,
with $1,000,000, an attack can be accomplished within 45 minutes in 15 years from
now. Moore’s law behaves similarly to a bank account which pays a 100% interest
rate every 18 months: The compound interest grows very, very quickly. Unfortu-
nately, there are few trustworthy banks which offer such an interest rate.
3 In the literature, the doubling period of Moore’s law is sometimes alternatively given as
24 months. In the security context, it barely matters what exactly the doubling period is. The
crucial fact is that computing power grows exponentially over time.
1.4 Modular Arithmetic and More Historical Ciphers 15
In this section we use two historical ciphers to introduce modular arithmetic with
integers. Even though the historical ciphers are no longer relevant, modular arith-
metic is extremely important in modern cryptography, especially for asymmetric
algorithms. Ancient ciphers date back to Egypt, where substitution ciphers were
used. A very popular special case of the substitution cipher is the Caesar cipher,
which is said to have been used by Julius Caesar to communicate with his army.
The Caesar cipher simply shifts the letters in the alphabet by a constant number of
steps. When the end of the alphabet is reached, the letters repeat in a cyclic way,
similarly to numbers in modular arithmetic.
To make computations with letters more practicable, we can assign each letter of
the alphabet a number. By doing so, an encryption with the Caesar cipher simply
becomes a (modular) addition with a fixed value. Instead of just adding constants,
a multiplication with a constant can be applied as well. This leads us to the affine
cipher.
Both the Caesar cipher and the affine cipher will now be discussed in more detail.
Almost all cryptographic algorithms, both symmetric ciphers and asymmetric ci-
phers, are based on arithmetic within a finite number of elements. Most number sets
we are used to, such as the set of natural numbers or the set of real numbers, are
infinite. In the following we introduce modular arithmetic, which is a simple way of
performing arithmetic on a finite set of integers. Let’s look at an example of a finite
set of integers from everyday life:
Example 1.4. Consider the hours on a clock. If you keep adding one hour, you ob-
tain:
1h, 2h, 3h, . . . , 11h, 12h, 1h, 2h, 3h, . . . , 11h, 12h, 1h, 2h, 3h, . . .
Even though we keep adding one hour, we never leave the set.
Let’s look at a general way of dealing with arithmetic in such finite sets.
{0, 1, 2, 3, 4, 5, 6, 7, 8}
We can do regular arithmetic as long as the results are smaller than 9. For instance:
2·3 = 6
4+4 = 8
16 1 Introduction to Cryptography and Data Security
But what about 8 + 4? Now we try the following rule: Perform regular integer arith-
metic and divide the result by 9. We then consider only the remainder rather than
the original result. Since 8 + 4 = 12, and 12/9 has a remainder of 3, we write:
8 + 4 ≡ 3 mod 9
a ≡ r mod m
if m divides a − r.
m is called the modulus and r is called the remainder.
There are implications from this definition that go beyond the casual rule “divide by
the modulus and consider the remainder.” We discuss these in the following.
42 = 4 · 9 + 6
It is somewhat surprising that for every given modulus m and number a, there are
(infinitely) many valid remainders. Let’s look at another example:
Example 1.7. We want to reduce 12 modulo 9. Here are several results that are cor-
rect according to the definition:
1.4 Modular Arithmetic and More Historical Ciphers 17
We note that every integer, i.e., every number without decimal places from minus
infinity to plus infinity, is a member in one of these equivalence classes.
For a given modulus m, it does not matter which element from a class we choose
for a given computation. This property of equivalence classes has major practical
implications. If we have involved computations with a fixed modulus — which is
usually the case in cryptography — we are free to choose the class element that
results in the easiest computation. Let’s look first at an example.
Example 1.8. The core operation in many practical public-key schemes is an expo-
nentiation of the form xe mod m, where x, e, m are very large integers, say, 2048 bits
each. Using a toy-size example, we can demonstrate two ways of doing modular ex-
ponentiation. We want to compute 38 mod 7. The first method is the straightforward
approach, and for the second one we switch within the equivalence class.
1. Naı̈ve method: We compute 38 = 6561 ≡ 2 mod 7, since 6561 = 937 · 7 + 2.
Note that we obtain the fairly large intermediate result 6561 even though we
know that our final result cannot be larger than 6.
2. Here is a much smarter method: First we perform two partial exponentiations:
38 = 34 · 34 = 81 · 81
We can now replace the intermediate results 81 by another member of the same
equivalence class. The smallest positive member modulo 7 in the class is 4 (since
81 = 11 · 7 + 4). Hence:
18 1 Introduction to Cryptography and Data Security
38 = 81 · 81 ≡ 4 · 4 = 16 mod 7
Of course, the final result of any modulo computation is always the same, no
matter how often we switch back and forth within equivalence classes.
0 ≤ r ≤ m−1
After studying the properties of modulo reduction we are now ready to define in
more general terms a structure that is based on modulo arithmetic. Let’s look at the
mathematical construction that we obtain if we consider the set of integers from
zero to m − 1 together with the operations addition and multiplication.
6 + 8 = 14 ≡ 5 mod 9
6 · 8 = 48 ≡ 3 mod 9
More about rings and finite fields, which are related to rings, is discussed in
Section 4.3. At this point, the following properties of rings are important:
We can add and multiply any two numbers from the set and the result is always
in the ring. A ring is said to be closed.
Addition and multiplication are associative, i.e., a + (b + c) = (a + b) + c and
a · (b · c) = (a · b) · c, for all a, b, c ∈ Zm .
Addition is commutative, i.e., a + b = b + a, for all a, b ∈ Zm .
There is the neutral element 0 with respect to addition, i.e., for every element
a ∈ Zm it holds that a + 0 ≡ a mod m.
For any element a in the ring, there is always the negative element −a such that
a + (−a) ≡ 0 mod m, i.e., the additive inverse always exists.
There is the neutral element 1 with respect to multiplication, i.e., for every ele-
ment a ∈ Zm it holds that a · 1 ≡ a mod m.
The multiplicative inverse exists only for some, but not for all, elements. Let
a ∈ Z. The inverse a−1 is defined such that
a · a−1 ≡ 1 mod m
If an inverse exists for a, we can divide by this element since b/a ≡ b · a−1 mod
m.
Another ring property is that a · (b + c) = (a · b) + (a · c) for all a, b, c ∈ Zm , i.e.,
the distributive law holds.
In summary, roughly speaking, we can say that the ring Zm is the set of integers
{0, 1, 2, . . . , m − 1} in which we can add, subtract, multiply and sometimes divide.
One issue that is worth discussing is the multiplicative inverse. It takes some ef-
fort to find the inverse (usually employing the extended Euclidean algorithm, which
is introduced in Section 6.3). However, there is an easy way of telling whether an
inverse for a given element a exists or not:
An element a ∈ Z has a multiplicative inverse a−1 if and only if gcd(a, m) = 1,
where gcd is the greatest common divisor, i.e., the largest integer that divides both
numbers a and m. The fact that two numbers have a gcd of 1 is of importance in
number theory, and there is a special name for it: If gcd(a, m) = 1, then a and m are
said to be relatively prime or coprime.
20 1 Introduction to Cryptography and Data Security
Example 1.10. Let’s see whether the multiplicative inverse of 15 exists in Z26 . Be-
cause
gcd(15, 26) = 1
the inverse must exist. (In fact, the inverse is 7 since 7 · 15 ≡ 1 mod 26.) On the other
hand, since
gcd(14, 26) = 2 6= 1
the multiplicative inverse of 14 does not exist in Z26 .
As mentioned earlier, the ring Zm , and thus integer arithmetic with the modulo
operation, is of central importance in modern public-key cryptography. In practice,
the integers involved have a length of 256–4096 bits so that we need ways to perform
modular arithmetic with such large numbers efficiently.
We now introduce another historical cipher, the shift cipher. It is actually a special
case of the substitution cipher and has a very elegant mathematical description.
The shift cipher itself is extremely simple: We simply shift every plaintext letter
by a fixed number of positions in the alphabet. For instance, if we shift by 3 posi-
tions, A would be substituted by d, B by e, etc. The only problem arises towards
the end of the alphabet: What should we do with X, Y, Z? As you might have
guessed, they should “wrap around”. That means X should become a, Y should be-
come b, and Z is replaced by c. (In light of this rule, a more accurate name for
the shift cipher would be “rotation cipher” but this name is rarely used.) Allegedly,
Julius Caesar used this cipher with a three-position shift.
The shift cipher also has an elegant description using modular arithmetic. For the
mathematical representation of the cipher, the letters of the alphabet are encoded as
numbers, as depicted in Table 1.3.
A B C D E F G H I J K L M
0 1 2 3 4 5 6 7 8 9 10 11 12
N O P Q R S T U V W X Y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
Both the plaintext letters and the ciphertext letters are now elements of the ring
Z26 . Also, the key, i.e., the number of shift positions, is in Z26 since more than
26 shifts would not make sense (27 shifts would be the same as 1 shift, etc.). The
encryption and decryption of the shift cipher are as follows.
1.4 Modular Arithmetic and More Historical Ciphers 21
Example 1.11. Let the key be k = 17, and the plaintext is:
As you can guess from the discussion of the substitution cipher earlier in this
book, the shift cipher is not secure at all. There are two ways of attacking it:
1. Since there are only 26 different keys (shift positions), one can easily launch a
brute-force attack by trying to decrypt a given ciphertext with all possible 26
keys. If the resulting plaintext is readable text, you have found the key.
2. As for the substitution cipher, one can also use letter frequency analysis. The
attack works even better for the shift cipher than for the substitution cipher. As
soon as the attacker has discovered the ciphertext letter for one plaintext letter,
he/she knows the number of shifts and thus has the key.
We try now to improve the shift cipher by generalizing the encryption function.
Recall that the actual encryption of the shift cipher was the addition of the key
yi ≡ xi + k mod 26. The affine cipher encrypts by multiplying the plaintext by one
part of the key followed by addition of another part of the key.
a · x + b ≡ y mod 26
a · x ≡ (y − b) mod 26
x ≡ a−1 · (y − b) mod 26
The restriction gcd(a, 26) = 1 stems from the fact that the key parameter a needs
to be inverted for decryption. We recall from Section 1.4.2 that an element a and the
modulus must be relatively prime for the inverse of a to exist. Thus, a must be in
the set:
a ∈ {1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25} (1.2)
But how do we find a−1 ? For now, we can simply compute it by trial and error:
For a given a we simply try all possible values a−1 until we obtain:
a · a−1 ≡ 1 mod 26
For instance, if a = 3, then a−1 = 9 since 3 · 9 = 27 ≡ 1 mod 26. Note that a−1 also
always fulfills the condition gcd(a−1 , 26) = 1 since the inverse of a−1 always exists.
In fact, the inverse of a−1 is a itself. Hence, for the trial-and-error determination of
a−1 one only has to check the values given in Equation (1.2).
Example 1.12. Let the key be k = (a, b) = (9, 13), and the plaintext be
Is the affine cipher secure? No! The key space is only a bit larger than in the case
of the shift cipher:
A key space with 312 elements can, of course, still be searched exhaustively, i.e.,
brute-force attacked, in a fraction of a second with any PC. In addition, the affine
cipher has the same weakness as the shift and substitution cipher: The mapping
between plaintext letters and ciphertext letters is fixed. Hence, it can also be broken
with letter frequency analysis.
The remainder of this book deals with strong cryptographic algorithms which are
of practical relevance.
1.5 Discussion and Further Reading 23
This book addresses practical aspects of cryptography and data security and is in-
tended to be used as an introduction; it is suited for classroom use, distance learning
and self-study. At the end of each chapter, we provide a discussion section in which
we briefly describe topics for readers interested in further study of the material.
Cryptography vs. Cybersecurity vs. Safety and Reliability As mentioned at the
very beginning of the book, cryptography is part of the broader fields of cyber-
security and IT security, where it is difficult to have a clear distinction between
those two latter terms. In fact, there exist many definitions for IT- and cybersecu-
rity. Traditionally, those terms were often described as dealing with “assurance of
the confidentiality, integrity and availability of information”, sometimes referred to
as the CIA triad. However, in addition to these three basic security goals, there are
often additional ones, including authenticity, accountability, non-repudiation and re-
liability. More about security services can be found in Section 10.1.3 of this book.
It is important to bear in mind that cryptography, IT- and cybersecurity all deal with
the protecting of information systems against malicious human actors, to which we
refer as attackers or adversaries in this book. In contrast, technical safety4 is con-
cerned with protection against dangers such as random failures that arise during the
regular use of technical systems. For instance, when driving a car, we want to ensure
that the brakes and the steering don’t fail — otherwise it would be unsafe. In order
to achieve such technical safety, systems must be reliable. In contrast to security,
safety and reliability are primarily not concerned with failure due to malicious ac-
tors but due to (random) technical failures. Even though reliability and security are
partially interdependent, they involve different aspects of protecting systems.
In order to approach the problem of IT security systematically, several general
frameworks exist. They typically follow a holistic approach by taking all security-
relevant factors into account. Such an approach requires that assets and correspond-
ing security needs have to be defined, and that the attack potential and possible
attack paths must be evaluated. Finally, adequate countermeasures have to be spec-
ified in order to realize an appropriate level of security for a particular application
or environment. There are numerous standards that can be used for evaluation and
help to define a secure system. Among the more prominent ones are ISO/IEC 27001
for Information Security Management Systems (ISMS), the Common Criteria for
Information Technology Security Evaluation [75] and FIPS PUBS [116]. In some
industries, standards help to establish a more domain-specific approach towards IT
security, e.g., ISO/IEC 62443 for industrial communication networks or ISO/SAE
21434 for cybersecurity engineering for road vehicles [147]. Moreover, frameworks
such as the NIST framework for improving the IT security in critical infrastructures
exist [29].
Historical Ciphers and Kerckhoffs’ Principle This chapter introduced a few his-
torical ciphers. However, there are many, many more, ranging from ciphers in an-
4 We note that safety is also used in non-technical contexts, e.g., food safety.
24 1 Introduction to Cryptography and Data Security
cient times to WWII encryption methods. To readers who wish to learn more about
historical ciphers and the role they played over the centuries, the books by Bauer
[30], Kahn [156], Singh [237] and Wrixon [254] are recommended. Besides mak-
ing fascinating bedtime reading, these books help one to understand the role that
military and diplomatic intelligence played in shaping world history. They also help
to show modern cryptography in a larger context.
Auguste Kerckhoffs was a Dutch cryptographer and linguist in the second half
of the nineteenth century. He observed that cryptography is often used incorrectly
in practice and postulated six principles in 1883, given below. What’s today widely
known as Kerckhoffs’ Principle is actually the second one from the list.
The system should be, if not theoretically unbreakable, unbreakable in practice.
The design of a system should not require secrecy, and compromise of the system
should not inconvenience the correspondents.
The key should be memorable without notes and should be easily changeable.
The cryptograms should be transmittable by telegraph.
The apparatus or documents should be portable and operable by a single person.
The system should be easy, neither requiring knowledge of a long list of rules
nor involving mental strain.
It is notable that several of the principles deal with the use of cryptography, as
opposed to the technical aspects of ciphers, a fact that was only relatively recently
observed by Sasse [226]. It was only in the 1990s that usable security emerged as a
proper research discipline within the scientific community.
Modular Arithmetic The mathematics introduced in this chapter, modular arith-
metic, belongs to the field of number theory. This is a fascinating subject area
which was, unfortunately, historically viewed as a “branch of mathematics with-
out applications”. Thus, it is rarely taught outside mathematics curricula. There is a
wealth of books on number theory. Among the classic introductory books are refer-
ences [204, 222]. A particularly accessible book written for non-mathematications
is reference [236].
Provable Security Due to our focus on practical cryptography, this book omits
most aspects related to the theoretical foundations of cryptographic algorithms and
protocols. One of the foundations of theoretical cryptography builds on the belief
that any cryptographic scheme should be accompanied by a rigorous mathematical
proof of its security (“security proof”) under a well-defined and reasonable crypto-
graphic hardness assumption. Examples of such hardness assumptions include the
assumption that computing discrete logarithms over certain prime-order groups is
difficult, the assumption that finding a small vector in a high-dimensional lattice is
difficult, or the assumption that finding a collision in a concrete hash function is
difficult. This concept is called provable security.5 Informally, “provable security”
5 The term “provable security” may be slightly misleading since it does not provide unconditional
proofs in a mathematical sense. It rather reduces a protocol’s security to a well-defined mathe-
matical hardness assumption. Some cryptographers therefore prefer to use the term “reductionist
security” instead.
1.5 Discussion and Further Reading 25
is achieved for a given cryptographic scheme when one provides (i) an algorith-
mic description of the cryptographic scheme; (ii) a formulation of a rigorous and
precise definition of the adversary’s capacities and goal (security model); and (iii)
a mathematical proof that the proposed scheme meets its security goal, assuming
some standard cryptographic assumption holds true. Point (iii) is remarkable and
deserves more attention. This mathematical proof shows formally that the only way
to break the scheme (within the defined security model) is to attack the underly-
ing cryptographic assumption. The proof holds for all possible attacks under the
same assumptions, even the ones we could not envision at the time of designing the
scheme.
The standard references for provable security are the textbooks by Katz/Lindell
[158] and Goldreich [123, 124]. Also recommended is the more recent online book
by Rosulek [223].
A few times this book also touches upon provable security, for instance the re-
lationship between Diffie–Hellman key exchange and the Diffie–Hellman problem
(cf. Section 8.4), the block cipher-based hash functions in Section 11.3.1, the secu-
rity of the HMAC message authentication scheme in Section 13.2, or the security
of lattice-based cryptography based on the conjectured intractability of the shortest-
vector problem in Section 12.2.
Advanced Cryptographic Schemes There are many advanced cryptographic con-
structions that go beyond the symmetric and asymmetric ciphers that are the main
topic of this book. In the following we sketch some of the more important examples
of advanced cryptography.
Homomorphic encryption allows computation on encrypted data, i.e., on cipher-
text, without first decrypting. A major application scenario is cloud computing,
where a user has a massive amount of data in encrypted form in the cloud. If the data
is, for instance, a large customer database, the user might be interested in download-
ing some customer records that fulfill certain criteria. The challenge is to perform
such a search on the ciphertext. It is relatively easy to construct partially homo-
morphic encryption schemes, which are constructions that allow one mathematical
operation to be performed on the ciphertext, typically multiplication or addition. In
fact, the two popular asymmetric encryption schemes RSA (cf. Chapter 7) and Elga-
mal (cf. Section 8.5) are partially homomorphic. Unfortunately, one mathematical
operation is not sufficient for the majority of practical applications. For a long time
finding a fully homomorphic encryption scheme that allows arbitrary operations was
considered the holy grail of cryptography. The first such scheme was proposed by
Gentry [122] in 2009, which is based on lattices (cf. Section 12.2). This original sys-
tem was quite impractical but since then numerous improvements have taken place.
At the time of writing, many competing schemes exist and use in practice is within
reach. This topic also relevant for the training of machine learning algorithms.
Another advanced cryptographic scheme is multiparty computation (MPC), also
known as secure multiparty computation. With MPC, several parties provide input
values and jointly compute a function from the inputs. The interesting part is that
when the protocol is completed the participants know only their own input and the
26 1 Introduction to Cryptography and Data Security
answer but nothing about the inputs of the other participants. A standard example is
a situation where three people want to find out what the highest salary in the group
is without revealing the individual salaries. Another application is determining the
outcome of an election, that is electronic voting, or the highest bid in an auction
based on encrypted data. The general theory of MPC was proposed in the late 1980s
but it took more than 20 years before the first practical application started to emerge.
A good reference source is [80]. Related to multiparty computation is secret sharing.
The idea of (general) secret sharing is that out of n participants t must collaborate
to compute a secret, e.g., a cryptographic key. A real-world scenario is that at least
2 out of 3 managers of a bank must get together to generate the secret code for
opening a safe. Secret sharing was proposed independently by Shamir and Blakley
in 1979 [229, 54].
Zero-knowledge proofs are concerned with proving certain knowledge to another
party without revealing the secret. They were originally motivated for authentication
without revealing a password or key. There are many other applications such as
anonymous payment schemes. Zero-knowledge proofs were originally proposed by
Goldwasser, Micali and Rackoff [125].
Other advanced cryptographic constructions include identity-based encryption,
attribute-based encryption, functional encryption and proxy-reencryption.
Research Community and General References Even though cryptography has
matured considerably since the 1970s, it is still a relatively young field compared to
other scientific disciplines, and every year brings many new developments and dis-
coveries. Many research results are published at the eight main events organized by
the International Association for Cryptologic Research (IACR). The proceedings of
the three IACR conferences Crypto, Eurocrypt and Asicacrypt, the four more spe-
cific area conferences Cryptographic Hardware and Embedded Systems6 (CHES),
Fast Software Encryption (FSE), Public Key Cryptography (PKC) and Theoretical
Cryptograpy Conference (TCC), as well as the Real World Cryptography (RWC)
symposium are excellent sources for tracking recent developments in the field of
cryptology. There are four top conferences in the broader field of computer secu-
rity (of which cryptography is one aspect): the IEEE Symposium on Security and
Privacy (IEEE S&P), the ACM Conference on Computer and Communications Se-
curity (CCS), the USENIX Security Symposium and the Network and Distributed
System Security Symposium (NDSS). It should be stressed that in cryptography as
well as in computer security there are many, many more conferences and workshops,
many of which are also of very high quality.
There are several good books on cryptography. A classic, if somewhat dated,
book is Applied Cryptography [227] by Schneier published in 1994, which helped
to popularize modern cryptography. A more recent book, which makes an excellent
addition to the book at hand, is Serious Cryptography: A Practical Introduction
to Modern Encryption by Aumasson [20]. With respect to reference sources, the
Handbook of Applied Cryptography by Menezes, van Oorschot and Vanstone [189]
and the Encyclopedia of Cryptography and Security [246] can be recommended. An
excellent reference for the much broader field of security engineering is Anderson’s
Security Engineering: A Guide to Building Dependable Distributed Systems [12].
Never ever develop your own cryptographic algorithm unless you have a team of
experienced cryptanalysts checking your design.
Do not use unproven cryptographic algorithms (i.e., symmetric ciphers, asym-
metric ciphers, hash functions) or unproven protocols.
Attackers always look for the weakest point of a cryptosystem. For instance, a
large key space by itself is no guarantee of a cipher being secure; the cipher might
still be vulnerable against analytical attacks.
Key lengths for symmetric algorithms in order to thwart exhaustive key-search
attacks are:
64 bits: insecure except for data with extremely short-term value.
112–128 bits: long-term security of several decades, including attacks by in-
telligence agencies unless they possess quantum computers. Based on our cur-
rent knowledge, attacks are only feasible with quantum computers (which do
not exist but might become reality in 1–2 decades).
256 bits: as above, but possibly secure against attacks by quantum computers.
Modular arithmetic is a tool for expressing historical encryption schemes, such as
the affine cipher, in a mathematically elegant way and provides the fundamental
basis for many modern cryptographic schemes.
28 1 Introduction to Cryptography and Data Security
Problems
1.1. The ciphertext below was encrypted using a substitution cipher. Decrypt the ci-
phertext without knowledge of the key.
1.2. We received the following ciphertext which was encoded with a shift cipher:
xultpaajcxitltlxaarpjhtiwtgxktghidhipxciwtvgtpilpit
ghlxiwiwtxgqadds.
1. Perform an attack against the cipher based on a letter frequency count: How
many letters do you have to identify through a frequency count to recover the
key? What is the cleartext?
2. Who wrote this message?
second, and she has a budget of $1 million. One ASIC costs $50, and we as-
sume 100% overhead for integrating the ASIC (manufacturing the printed circuit
boards, power supply, cooling, etc.). How many ASICs can we run in parallel
with the given budget? How long does an average key search take? Relate this
time to the age of the Universe, which is about 1010 years.
2. We try now to take advances in computer technology into account. Predicting
the future tends to be tricky but the estimate usually applied is Moore’s law,
which states that the computing power doubles every 18 months while the costs
of integrated circuits stay constant. How many years do we have to wait until
a key-search machine can be built to break AES with 128 bits with an average
search time of 24 hours? Again, assume a budget of $1 million (do not take
inflation into account).
1.4. We now consider the relation between passwords and key size. For this purpose
we consider a cryptosystem where the user enters a key in the form of a password.
1. Assume a password consisting of 8 letters, where each letter is encoded with the
ASCII code (7 bits per character, i.e., 128 possible characters). What is the size
of the key space which can be constructed by such passwords?
2. What is the corresponding key length in bits?
3. Assume that most users use only the 26 lowercase letters from the alphabet in-
stead of the full 7 bits of the ASCII-encoding. What is the corresponding key
length in bits in this case?
4. At least how many characters are required for a password in order to generate a
key length of 128 bits in case of letters consisting of
a. 7-bit characters?
b. 26 lowercase letters from the alphabet?
1.5. In case of a brute-force attack, we have to search the entire key space of a cipher.
To prevent such a search from being successful, the key space must be sufficiently
large. It is crucial to observe that the key space grows exponentially with the key
length in bits. With this problem we want to get a better understanding of such an
exponential growth.
According to an anecdote, the inventor of chess asked the king for a humble reward
in the form of grains of rice: On the first field of the chess board, the king should
put one grain of rice, on the second field two grains of rice, on the third field four
grains etc.
1. How many grains of rice are on the last field of the chess board?
2. A single grain of rice has a weight of approximately 0.03 g. What is the total
weight of all grains on the board? Compare the total weight with the worldwide
yield of approximately 480 million tons per year.
Now, let us consider a piece of paper that is repeatedly folded. The thickness of the
paper increases exponentially: It has twice the thickness if folded once, four times
the thickness if folded twice etc. For the following tasks, we assume a piece of paper
which is 0.1 mm thick.
30 1 Introduction to Cryptography and Data Security
1. Describe which of the following attackers can read (and meaningfully manipu-
late) messages.
a. A hacker who can listen to (and alter) messages on the air link between Alice
and her base station.
b. The mobile operator who runs and controls base station A.
c. A national law enforcement agency that has power over the mobile operator
and gains access to base station A or B.
d. An intelligence agency of a foreign country that can wiretap any internet com-
munication.
e. The mobile operator who runs and controls base station B.
1.6 Problems 31
f. A hacker who can listen to (and alter) messages on the air link between Bob
and his base station.
We now look at the same communication system but this time Alice and Bob use
E2EE, cf. Figure 1.8
2. Describe which of the following attackers can read (and meaningfully manipu-
late) messages in the communication systems with E2EE.
a. A hacker who can listen to (and alter) messages on the air link between Alice
and her base station.
b. The mobile operator who runs and controls base station A.
c. A national law enforcement agency that has power over the mobile operator
and gains access to base station A or B.
d. An intelligence agency of a foreign country that can wiretap any internet com-
munication.
e. The mobile operator who runs and controls base station B.
f. A hacker who can listen to (and alter) messages on the air link between Bob
and his base station.
1.7. As we learned in this chapter, modular arithmetic is the basis of many cryp-
tosystems. We will now provide a number of exercises that help us get familiar with
modular computations.
Let’s start with an easy one: Compute the following result without a calculator.
1. 15 · 29 mod 13
2. 2 · 29 mod 13
3. 2 · 3 mod 13
4. −11 · 3 mod 13
The results should be given in the range from 0, 1, . . . , modulus-1. Briefly describe
the relation between the different parts of the problem.
32 1 Introduction to Cryptography and Data Security
1.9. We consider the ring Z4 . Construct a table that describes the addition of all
elements in the ring with each other in the following form:
+ 0 1 2 3
0 0 1 2 3
1 1 2 ···
2 ···
3
1. Construct the multiplication table for Z4 .
2. Construct the addition and multiplication tables for Z5 .
3. Construct the addition and multiplication tables for Z6 .
4. There are elements in Z4 and Z6 without a multiplicative inverse. Which ele-
ments are these? Why does a multiplicative inverse exist for all nonzero elements
in Z5 ?
1.10. What is the multiplicative inverse of 5 in Z11 , Z12 , and Z13 ? You can do a
trial-and-error search using a calculator or a PC.
With this simple problem we want now to stress the fact that the inverse of an
integer in a given ring depends completely on the ring considered. That is, if the
modulus changes, the inverse changes. Hence, it doesn’t make sense to talk about
an inverse of an element unless it is clear what the modulus is. This fact is crucial for
the RSA cryptosystem, which is introduced in Chapter 7. The extended Euclidean
algorithm, which can be used for computing inverses efficiently, is introduced in
Section 6.3.
Cliché Gautier
75. — AU TIMMI, FABRICATION DES BRIQUES CREUSES, ÉLÉMENTS DU PISÉ.
Cliché Gautier
76. — ADRAR (Timmi), CAPITALE DU TOUAT.
Type de ksar actuel, en pisé, quadrangulaire, flanqué de tours carrées
E.-F. Gautier. — Sahara Algérien. Pl. XLI.
Cliché Gautier
77. — TIMIMOUN — UNE RUE DANS LA PALMERAIE.
D’un mur à l’autre, une poutre en tronc de palmier, qui a fléchi sous son propre poids
comme d’habitude.
Cliché Gautier
78. — TIMIMOUN. — UN COIN DU KSAR.
La place principale, traversée par une séguia ; — toits en terrasse de pisé.
E.-F. Gautier. — Sahara Algérien. Pl. XLII.
Cliché Laperrine
79. — UNE PALMERAIE ENSABLÉE.
A gauche, sur la crête de la dune, et pour essayer de la fixer, des haies en
palmes.
Cliché Gautier
80. — TIMIMOUN. — BOUCHERS HARATIN DÉPEÇANT UN CHAMEAU.