02_classicrypt
TRANSCRIPT
-
7/29/2019 02_ClassiCrypt
1/36
Classical Cryptography
Shift cipher
Substitution cipher
Affine cipherVigenre Cipher
Hill Cipher
1
-
7/29/2019 02_ClassiCrypt
2/36
References
Douglas Stinson, Cryptography: Theory and
Practice, 3rd, Chapman & Hall CRC, 2006.
Chapter 1
2
-
7/29/2019 02_ClassiCrypt
3/36
Secure communication scheme
3
-
7/29/2019 02_ClassiCrypt
4/36
The set of integers modulo m:
Remarks:
Congruences
. Examples:
= {0, 1, 2, , 25}.
14 + 20 = 8 in .
5*7 = 9 in .
4
We will always consider
(a mod b) >= 0
Lab computing: try
operators + and * modulo
m in C, Java, Maple,
Matlab and Python.
-
7/29/2019 02_ClassiCrypt
5/36
Lab computing: tryMOD or % operator
in C, Java, Maple, Matlab
and Python.
5
-
7/29/2019 02_ClassiCrypt
6/36
The Shift Cipher
For the particular key K = 3, the cryptosystem is often called the
Caesar Cipher, which was purportedly used by Julius Caesar. 6
-
7/29/2019 02_ClassiCrypt
7/36
The Shift CipherEncryption
7
-
7/29/2019 02_ClassiCrypt
8/36
The Shift CipherDecryption
8
-
7/29/2019 02_ClassiCrypt
9/36
Caesar cipher (K = 3)
x = NGUYENTHANHNHUT
y = QJXBHQWKDQKQKXW
9
owCryptool it!
-
7/29/2019 02_ClassiCrypt
10/36
Practical cryptosystems1. Each encryption function ekand each decryption
function dkshould be efficiently computable.2. An opponent, upon seeing a ciphertext string y,
should be unable to determine the key k that was
used, or the plaintext string x.
Security
The process of attempting to compute the key k, given
a string of ciphertext y, is called cryptanalysis.
10
-
7/29/2019 02_ClassiCrypt
11/36
Security of the Shift cipher The Shift Cipher (modulo 26) is not secure.
It can be cryptanalyzed by the obvious method ofexhaustive key search.
Since there are only 26 possible keys, it is easy to try
every possible decryption rule dk(k = 0, , 25) until a"meaningful" plaintext string is obtained.
On average, a plaintext will be computed using thismethod after trying 26/2 = 13 decryption rules.
a necessary condition for a cryptosystem to besecure is that an exhaustive key search should beinfeasible; i.e., the keyspace should be very large.
11
-
7/29/2019 02_ClassiCrypt
12/36
Exercise
Lab computing: build a
ShiftCipher encrypt anddecrypt functions to do this
Take a shortbreak
12
-
7/29/2019 02_ClassiCrypt
13/36
The Substitution Cipher
13
-
7/29/2019 02_ClassiCrypt
14/36
The Substitution CipherLab
computing:
decrypt thisby define a
SubCipher
decr t
A key for the Substitution Cipher just consists of a
permutation of the 26 alphabetic characters. The number of possible permutations is 26!, which is
more than 4*1026, a very large number.
14
?
functionTry Cryptool it!
-
7/29/2019 02_ClassiCrypt
15/36
Euler phi-function
Lab com utin : define GCD
Ex:
(10) = 4.
(11) = 10.
15
and PHI functions in Python tocompute gcd(a,b) and phi(n).
Compare time running with
MAPLE.
-
7/29/2019 02_ClassiCrypt
16/36
Compute the Euler phi-function
16
-
7/29/2019 02_ClassiCrypt
17/36
The multiplicative inverse modulo m
Form = 26:
17
-
7/29/2019 02_ClassiCrypt
18/36
Exercise
18
-
7/29/2019 02_ClassiCrypt
19/36
The Affine Cipher
19
-
7/29/2019 02_ClassiCrypt
20/36
20
So the three ciphertext characters are 0, 23, and 6, which
corresponds to the alphabetic string AXG.
-
7/29/2019 02_ClassiCrypt
21/36
Security of the Affine cipher
21
-
7/29/2019 02_ClassiCrypt
22/36
1.11
22
Take a short
break
-
7/29/2019 02_ClassiCrypt
23/36
The Vigenre Cipher
Each key k is an alphabetic string of length m, called
a keyword.
The Vigenere Cipher encrypts m alphabetic charactersat a time.
23
-
7/29/2019 02_ClassiCrypt
24/36
24
Try Cryptool it!
-
7/29/2019 02_ClassiCrypt
25/36
Security of the Vigenere Cipher
The number of possible keywords of length m is 26m,
even for relatively small values of m, an exhaustive keysearch would require a long time.
An alphabetic character can be mapped to one of m
poss e a p a e c c arac ers assum ng a e eywor
contains m distinct characters). Such a cryptosystem is
called apolyalphabetic cryptosystem.
In general, cryptanalysis is more difficult for
polyalphabetic than formonoalphabetic cryptosystems
(Shift Cipher, Substitution Cipher).
25
-
7/29/2019 02_ClassiCrypt
26/36
The Hill Cipher
26
-
7/29/2019 02_ClassiCrypt
27/36
27
-
7/29/2019 02_ClassiCrypt
28/36
28
-
7/29/2019 02_ClassiCrypt
29/36
1.12
29
-
7/29/2019 02_ClassiCrypt
30/36
1.14
Think about the security of the Hill Cipher!
30
-
7/29/2019 02_ClassiCrypt
31/36
The Permutation Cipher
31
-
7/29/2019 02_ClassiCrypt
32/36
32
-
7/29/2019 02_ClassiCrypt
33/36
33
-
7/29/2019 02_ClassiCrypt
34/36
1.16
34
-
7/29/2019 02_ClassiCrypt
35/36
1.17
35
-
7/29/2019 02_ClassiCrypt
36/36
The Permutation Cipher is a special case of
the Hill Cipher
36