01 Intro
01 Intro
Introduction
1 / 53
Textbook
https://www.crypto-textbook.com
2 / 53
Outline
1 Introduction
2 Symmetric Cryptography
3 Cryptanalysis
5 Lessons Learned
World War II
German Enigma encryption machine
4 / 53
Back to about 2000 B.C
Scytale of Sparta
5 / 53
Classification
Cryptology
Cryptography Cryptanalysis
6 / 53
Outline
1 Introduction
2 Symmetric Cryptography
3 Cryptanalysis
5 Lessons Learned
Encryption
Goal: Confidentiality of transmitted (or stored) message.
Insecure channel
Oscar
8 / 53
Cryptography Approach
Insecured channel
Oscar
• Bob knows a key k that Oscar doesn’t (Oscar know the
system).
• Alice can encrypt x such that knowledge of k allows for
decryption.
• Oscar sees ciphertext y, but learns nothing about x.
9 / 53
Notation
10 / 53
Symmetric Cryptography
Alice & Bob both know key k. shared symmetric key
Algorithms:
Setup:
• Someone (may be Alice or Bob) computes k ← Gen(1λ ).
• and ensures that Alice & Bob both have k (and Oscar doesn’t)
(How?!)
11 / 53
Symmetric-key cryptosystem
y ← Enc(k, x) x = Dec(k, y)
y ← Enc(k, x)
k k
Oscar
12 / 53
Questions
13 / 53
Kerckhoffs’ Principle
14 / 53
NaCl (Networking and Cryptography
library)
15 / 53
Substitution Cipher
Example
A→k
B→d
C→w
···
16 / 53
Exercise
Question
• Can you guess what the plaintext is?
• Is the substitution cipher secure?
17 / 53
Outline
1 Introduction
2 Symmetric Cryptography
3 Cryptanalysis
5 Lessons Learned
First Attack: Brute-Force or
Exhaustive Key Search
Dec(ki , y) = x.
19 / 53
Brute-Force Attack for
Substitution Cipher
Question
What is the key space of the cipher?
20 / 53
Second Attack: Letter Frequency Analysis
A→k
B→d
C→w
···
21 / 53
• For instanc, „e“ is the most common letter in English; almost 13% of all letters in a
typical English text are „e“.
Second
• The next most Attack:
common one is „t“ withLetter
about 9%.Frequency Analysis
Letter frequencies in English
14.0000
12.0000
10.0000
Frequency in %
8.0000
6.0000
4.0000
2.0000
0.0000
E T A O I N S H R D L C U M W F G Y P B V K J X Q Z
Letters
22 / 53
• Letters have very different frequencies in the English language
• Moreover: the frequency ofExercise:
plaintext letters is preserved in the ciphertext.
Decrypt the ciphertext
• For instanc, „e“ is the most common letter in English; almost 13% of all letters in a
typical English text are „e“.
1 iq ifcc vqqr fb rdq vfllcq na rdq cfjwhwz hr bnnb
• The
2 next most common one is „t“ with about 9%.
hcc hwwhbsqvqbre hwq vhlq
Letter frequencies in English
14.0000
12.0000
10.0000
Frequency in %
8.0000
6.0000
4.0000
2.0000
0.0000
E T A O I N S H R D L C U M W F G Y P B V K J X Q Z
Letters
23 / 53
Security Objective
24 / 53
Attacks
Assume k is reused
25 / 53
Overview of Cryptanalysis
Cryptanalysis
Mathematical Brute-Force
Analysis Attack
26 / 53
Types of Cryptanalysis: A Diverse Toolkit
27 / 53
Key Length: A Measure of Strength
28 / 53
Key Lengths: A Matter of Context
29 / 53
Foretelling the Future
30 / 53
Outline
1 Introduction
2 Symmetric Cryptography
3 Cryptanalysis
5 Lessons Learned
Example
{0, 1, 2, 3, 4, 5, 6, 7, 8}
2×3=6
4+4=8
8 + 4 ≡? mod 9
32 / 53
Modulo Operation
• Let a, r, m ∈ Z (where Z is the set of all integers) and m > 0.
We write
a ≡ r mod m
if m divides (a − r).
• The integer m is called the modulus and r is called the
remainder.
Example
• Let a = 13 and m = 9. Find a value r.
• 13 ≡ 4 mod 9.
• Check: (a − r) = (13 − 4) = 9.
33 / 53
Computation of the Remainder
a ≡ r mod m.
Example
• Let a = 42 and m = 9. Then 42 = 4 · 9 + 6 and therefore
42 ≡ 6 mod 9.
• Let a = 58 and m = 7. Then 58 = 8 · 7 + 2 and therefore
58 ≡ 2 mod 7.
34 / 53
The Remainder Is Not Unique
Example
Let a = 42 and m = 9.
• 42 = 4 · 9 + 6 then r = 6, check (42 − 6) = 36 and 9 | 36.
• 42 = 3 · 9 + 15 then r = 15, check (42 − 15) = 27 and 9 | 27.
• 42 = 5 · 9 + (−3) then r = −3, check (42 + 3) = 45 and 9 | 45.
35 / 53
All Members of a Given Equivalence
Class Behave Equivalently
Let’s look at all equivalent class for m = 5.
D·B−D=A
13 · 6 − 8 = 208 − 8 = 200 ≡ 0 (mod 5)
13 · 1 − 3 = 3 − 3 = 0 (mod 5)
8 · 6 − (−7) = 48 + 7 = 55 ≡ 0 (mod 5)
36 / 53
Important Application
Example
How to calculate 38 mod 7?
37 / 53
Definition (Integer Rings)
The “integer ring” Zm consists of:
1 The set Zm = {0, 1, 2, · · · , m − 1}
2 Two operations “+” and “·” for all a, b ∈ Zm such that:
• a + b ≡ c mod m for some c ∈ Zm
• a · b ≡ d mod m for some d ∈ Zm
38 / 53
Example
• Let m = 9, i.e., we are dealing with the ring
Z9 = {0, 1, 2, 3, 4, 5, 6, 7, 8}.
• Here are two simple computations in this ring:
6 + 8 = 14 ≡ 5 mod 9
6 · 8 = 48 ≡ 3 mod 9
39 / 53
Properties of Rings 1
• 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:
a + (b + c) = (a + b) + c
a · (b · c) = (a · b) · c
• Addition is commutative: a + b = b + a.
• 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.
40 / 53
Properties of Rings 2
41 / 53
Multiplicative Inverse
a · a−1 ≡ 1 mod m.
42 / 53
Multiplicative Inverse in Z26
7 · 15 ≡ 1 mod 26.
43 / 53
Encoding of Letters for the Shift Cipher
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
Table: Encoding of letters for the shift cipher
44 / 53
Shift Cipher
45 / 53
Example
• Let the key be k = 17, and the plaintext is:
46 / 53
Affine Cipher
a · x + b ≡ y mod 26
a · x ≡ ( y − b) mod 26
x ≡ a−1 · ( y − b) mod 26
47 / 53
Example
Let the key be k = (a, b) = (9, 13), and the plaintext be ATTACK:
x 1 , x 2 , . . . , x 6 = 0, 19, 19, 0, 2, 10
48 / 53
Affine Cipher Security
49 / 53
Outline
1 Introduction
2 Symmetric Cryptography
3 Cryptanalysis
5 Lessons Learned
Lesson Learned (Part 1)
51 / 53
Lesson Learned (Part 2)
• 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 intelligence agencies unless they possess quantum
computers. Based on our current 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.
52 / 53
Thank you!
53 / 53