Title: Classical Cryptography
1Classical Cryptography
- 1. Introduction Some Simple Cryptosystems
2Outline
- 1 Introduction Some Simple Cryptosystems
- lt1gt The Shift Cipher
- lt2gt The Substitution Cipher
- lt3gt The Affine Cipher
- lt4gt The Vigenère Cipher
- lt5gt The Hill Cipher
- lt6gt The Permutation Cipher
- lt7gt Stream Ciphers
- 2 Cryptanalysis
- lt1gt Cryptanalysis of the Affine Cipher
- lt2gt Cryptanalysis of the Substitution Cipher
- lt3gt Cryptanalysis of the Vigenère Cipher
- lt4gt Cryptanalysis of the Hill Cipher
- lt5gt Cryptanalysis of the LFSR Stream Cipher
3Introduction Some Simple Cryptosystems
4Introduction Some Simple Cryptosystems
- Definition 1.1 A cryptosystem is a five-tuple
(P,C,K,E,D) satisfies - P is a finite set of possible plaintexts
- C is a finite set of possible ciphertexts
- K, the keyspace, is a finite set of possible keys
- For each K?K, there is an encryption rule eK?E
and a corresponding decryption rule dK?D -
-
- dK(eK(x))x for every plaintext x?P
5Introduction Some Simple Cryptosystems
- Definition 1.2 a and b are integers,
- m is a positive integer
- congruence ab (mod m) if m divides b-a
- Zm the set 0,1,,m-1
- with 2 operations and ?
- 10204 in Z26 (1020 mod 264)
- 10?2018 in Z26 (10?20 mod 2618)
6Introduction Some Simple Cryptosystems
- lt1gt Shift Cipher
- Cryptosystem 1.1 Shift Cipher
- P C K Z26
- K, x, y ?Z26
- eK(x)(xK) mod 26
- dK(y)(y-K) mod 26
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
7Introduction Some Simple Cryptosystems
- eg. Suppose K11
- Plaintext student
- Ciphertext DEFOPZE
plaintext s t u d e n t
plaintext 18 19 20 3 4 13 19
K 3 4 5 14 15 25 4
ciphertext D E F O P Z E
8Introduction Some Simple Cryptosystems
- lt2gt Substitution Cipher
- Cryptosystem 1.2 Substitution Cipher
- PCZ26
- K all possible permutations of the 26 symbols
- For each p?K
- ep(x)p(x)
- dp(y)p-1(y)
- where p-1 is the inverse permutation to p
9Introduction Some Simple Cryptosystems
- eg.
- Plaintext student
- Ciphertext VMUSHSM
x a b C d e f g h i j k l m
ep(x) X N Y A H P O G Z Q W B T
x n o p q r s t u v w x y z
ep(x) S F L R C V M U E K J D I
10Introduction Some Simple Cryptosystems
- lt3gt Affine Cipher
- Theorem 1.1 axb (mod m) has a unique solution
x?Zm for every b?Zm iff gcd(a,m)1 - Definition 1.3 Suppose a1 and m2 are integers
- a and m are relatively prime if gcd(a,m)1
- f(m) the number of integers in Zm that are
relatively prime to m - Theorem 1.2 Suppose
-
11Introduction Some Simple Cryptosystems
- Definition 1.4 Suppose a?Zm
- a-1 mod m
- the multiplicative inverse of a modulo m
- aa-1a-1a1 (mod m)
- Cryptosystem 1.3 Affine Cipher
- P C Z26
- K(a,b) ?Z26?Z26 gcd(a,26)1
- For K(a,b)?K x, y?Z26
- eK(x)(axb) mod 26
- dK(y)a-1(y-b) mod 26
12Introduction Some Simple Cryptosystems
- e.g. Suppose K(7,3)
- 7-1 mod 26 15
- Plaintext student
- Ciphertext ZGNYFQG
eK(x)(7x3) mod 26
dK(y)15(y-3) mod 26
plaintext s t u d e n t
plaintext 18 19 20 3 4 13 19
eK(x) 25 6 13 24 5 16 6
ciphertext Z G N Y F Q G
13Introduction Some Simple Cryptosystems
- lt4gt Vigenère Cipher
- Cryptosystem 1.4 Vigenère Cipher
- m a positive integer
- P C K (Z26)m
- For a key K(k1,k2,,km)
- eK(x1,x2,,xm)(x1k1,x2k2,,xmkm)
- dK(y1,y2,,ym)(y1-k1,y2-k2,,ym-km)
14Introduction Some Simple Cryptosystems
- e.g. Suppose m4 and K(2,8,15,7)
- Plaintext student
- Ciphertext UBJKGVI
plaintext s t u d e n t
plaintext 18 19 20 3 4 13 19
K 2 8 15 7 2 8 15
ciphertext 20 1 9 10 6 21 8
15Introduction Some Simple Cryptosystems
- lt5gt Hill Cipher
- Definition 1.5 Suppose A(ai,j) is an m?m matrix
- Ai,j the matrix obtained from A by deleting the
ith row and the jth column - det A the determinant of A
- m1 det Aa1,1
- mgt1 for any fixed i
- A(ai,j) the adjoint matrix of A
- ai,j(-1)ijdet Aj,i
16Introduction Some Simple Cryptosystems
- Theorem 1.3 Suppose K(ki,j) is an m?m
invertible matrix over Zn - K-1(det K)-1K
- e.g.
-
- det K11?7-8?3
mod 261 - K-1(det K)-1K
17Introduction Some Simple Cryptosystems
- Cryptosystem 1.5 Hill Cipher
- M 2 is an integer
- P C (Z26)m
- K m?m invertible matrices over Z26
- For a key K
- eK(x)xK
- dK(y)yK-1
- where K-1 is the inverse of K
18Introduction Some Simple Cryptosystems
- e.g.
-
- Plaintext GOD (6 14 3)
- Ciphertext WTJ (22 19 9)
19Introduction Some Simple Cryptosystems
- lt6gt Permutation Cipher
- Cryptosystem 1.6 Permutation Cipher
- m is a positive integer
- P C (Z26)m
- K consist of all permutations of 1,,m
- For a key(a permutation) p
- ep(x1,,xm)(xp(1),,xp(m))
-
-
- where p-1 is the inverse permutation to p
20Introduction Some Simple Cryptosystems
- e.g. Suppose m6
- Plaintext CYBERFORMULA
- Ciphertext BRCFEYMLOAUR
x 1 2 3 4 5 6
p(x) 3 5 1 6 4 2
plaintext C Y B E R F O R M U L A
ciphertext B R C F E Y M L O A U R
21Introduction Some Simple Cryptosystems
- lt7gt Stream Ciphers
- Block ciphers
- Plaintext string x x1x2 (each xi is a
plaintext) - Ciphertext string y y1y2 eK(x1)eK(x2)
- Stream ciphers
- Plaintext string x x1x2
- Generate a keystream (by using some K) z z1z2
- Ciphertext string y y1y2 ez1(x1)ez2(x2)
22Introduction Some Simple Cryptosystems
- Definition 1.6 A synchronous stream cipher is a
tuple (P,C,K,L,E,D) with a function g - P a finite set of possible plaintexts
- C a finite set of possible ciphertexts
- K a finite set of possible keys
- L a finite set called the keystream alphabet
- g the keystream generator
- Input K
- g generates an infinite string z1z2
23Introduction Some Simple Cryptosystems
- Definition 1.6 (cont.)
- For each z?L, there is an encryption rule ez?E
and a corresponding decryption rule dZ?D -
-
- dz(ez(x))x for every plaintext x?P
24Introduction Some Simple Cryptosystems
- Vigenère Cipher can be defined as a synchronous
stream cipher - K (Z26)m
- P C L Z26
- ez(x)(xz) mod 26
- dz(y)(y-z) mod 26
- Keystream z1z2
- k1k2..km k1k2..km k1k2..km
25Introduction Some Simple Cryptosystems
- Keystream can be produced efficiently in hardware
using a LFSR (Linear Feedback Shift Register) - k1 would be tapped as the next keystream bet
- k2,km would each be shifted 1 stage to the left
- The new value of km would be
- this is linear feedback (see Figure 1.2)
- This system is modulo 2
26Introduction Some Simple Cryptosystems
- e.g. in Figure 1.2,suppose K(1,0,0,0)
- c01, c11, c20, c30
- The keystream is
- 100010011010111
Figure 1.2
27Introduction Some Simple Cryptosystems
- Non-synchronous stream cipher
- Each keystream element zi depends on previous
plaintext or ciphertext elements - Cryptosystem 1.7 Autokey Cipher
- P C K L Z26
- z1K, zixi-1 for all igt1
- For x, y, z ?Z26
- ez(x)(xz) mod 26
- dz(y)(y-z) mod 26
28Introduction Some Simple Cryptosystems
- e.g. Suppose K8
- Plaintext student
- Ciphertext ALNXHRG
plaintext s t u d e n t
plaintext 18 19 20 3 4 13 19
keystream 8 18 19 20 3 4 13
ciphertext 0 11 13 23 7 17 6
ciphertext A L N X H R G