Classical Cryptosystems Shift Ciphers (Caesar) y= x+k (mod 26) Affine Ciphers y=ax+b (mod 26) Vigenere Ciphers codes=(02,14,03,04,18) Substitution Ciphers (26! Permutations) Sherlock Holmes P27 (Visual Substitution) The Playfair and ADFG[V]X Ciphers Block Ciphers PseudoRandom Number Generators
Shift Cipher y=x+k (mod 26) attack XQQXZH (k=23 mod 26) great ITGCV (k=2 mod 26) 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 a b c d
Affine Cipher y=ax+b mod 26 how are you QZNHOBXZD, (a,b)=(5,7) wo??er?u? NZUWBOGDK, (a,b)=(5,7) gcd(a,26)=1 is required Table for ax=1 mod 26 1(1) 7(15) 15( 7) 21(5) 3(9) 9( 3) 17(23) 23(17) 5(21) 11(19) 19(11) 25(25)
Frequencies of Letters in English 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
Vigenere Cipher The same letter need not be enciphered as the same letter Key: vector=(21,4,2,19,14,17) h e r e i s h o w i t w o r k s v e c t o r v e c t o r v e c t C I T X W J C S Y B H N J V M L Attacks according to the following information (1) The frequencies of letters in English A0=[.082,.015,.028, …,.020,.001] is larger than, j=1,2,...,25 (2) Key length (3) Digrams (e.g., WX) or trigrams (e.g., FHQ)
Sherlock Holmes A visual substitution (use a visual pattern to replace each English letter)
The Playfair p l a y f i r b c d e g h k m n o q s t u v w x z meet at the schoolhouse me et at th es ch ox ol ho us ex EG MN FQ QM KN BK SV VR GQ XN KU
ADFGX Cipher A D F G X A p g c e n D b q o z r F s l a f t G m d v i w X k u y x h Kaiser Wilhelm XA FF GG FA AG DX GX GG FD XX AG FD GA
Block Ciphers Hill cipher, DES, AES, RSA, Electronic Codebook, Elliptic Curve cryptosystems Find the inverse of A and B (mod 26) A=3 4 inv-A= M = [1 2 3; 4 5 6; ] inv-M=[22 5 1; ; ]
Hill Cipher blockcipherx ( ) (2 10 2) (8 15 7) ( ) ( )M=( ) (mod 26) = RBZ (2 10 2)M =( ) (mod 26) = MUE blockcipher RBZMUEPYONOM
Binary Numbers and ASCII ASCII – American Standard Code for Information Interchange A=65= ~ Z=90= a=97= ~ z=122= [33~47] ! “ # $ % & ' ( ) * +, -. / [48~64] : ; ¡ = ¿
One-time Pads By Gilbert Vernam and Joseph Mauborgne around 1918 The key is a random sequence of 0’s and 1’s of the same length as the message. Once a key is used, it is discarded and never used again ⊕ = Used in “hot line” between USSR and US
Pseudo-random Bit Generation Rand() based on a linear congruential generator x n =ax n-1 + b (mod m) with gcd(a,m)=1, m= = x 0 =seed, a=16847, b= Blum-Blum-Shub (BBS) bit generator Select n=pq, the product of two primes x 0 =seed=x 2 (mod n), where gcd(x,n)=1 x j =(x j-1 ) 2 (mod n) and b j = x j ^ 1
Linear Feedback Shift Register (LFSR) Sequences (mod 2) Plaintext (x 1, x 2, x 3, x 4, x 5 )=(0,1,0,0,0) X n+5 =X n + X n+2 (mod 2) X n+m =c 0 x n +c 1 x n+1 +····+c m-1 x n+m-1 (mod 2) X n+31 =X n + X n+3 (mod 2) has period
Proposition Let M be a matrix (mod 2) {x 1 x 2 x 3 ··· x m x 2 x 3 x 4 ··· x m+1 ︰ x m x m+1 x m+2 ··· x 2m-1 }={x j } If the sequence {x j } satisfies a linear recurrence of length less than m, then det(M)=0. Cinversely, if the sequence satisfies a linear recurrence of length m and det(M)=0, then the sequence also satisfies a linear recurrence of length than m.
(plaintext) (key) (ciphertext)
Cryptanalysis Suppose X n+2 =C 0 X n +C 1 X n+1
Cryptanalysis If the linear recurrence of length is less than m,then
Irreducible Polynomial mod 2 x n+m =c 0 x n +c 1 x n+1 +····+c m-1 x n+m-1 (mod 2) f(T)=T m –c m-1 T m-1 - ‥‥ - c 1 T 1 – c 0 If f(T) is irreducible, then its period divides 2 m – 1, an interesting case is when 2 m – 1 is a prime (Mersenne primes) 2 31 – 1 = is a prime number Further discuss this topic later
Enigma A mechanical encryption device used by the Germans in World War II. A rotor machine
Enigma
Schematic diagram of Enigma
K:keyboard R:revering drum S:plugboard L,M,M:rotors
Single Rotor 26 substitution cipher A1,A27,A53…. A2,A28,A54…. Frequency analysis
Three Rotors 26*26*26*6= possibilities ways of interchanging six pairs of letters on the plugboard.
To Attack Enigma A codebook containing the daily settings. During a given day,every first letters in plaintexts is encrypted in the same substitution cipher.
To Attack Enigma Message key:a sequence of three letters,for example,r,f,u. rfurfu Daily setting Encrypting the message key Reset
To Attack Enigma dmqvbn vonpuy pucfmq AD=(dvpf..)… AD=(dvpfkxgzyo)(eijmunqlht)(bc)(rw)(a)(s)
The Effect of the Plugboard AD has cycles of length 10,10,2,2,1,1. SADS -1 has cycles of length 10,10,2,2,1,1. The cycle lengths remain unchanged. Substitution cipher
Bletchley Park
Exercises Problems from 2.13 Exercises on p.55~59 Problems from 2.14 Exercises on p.59~62