Historical Ciphers Part 2
Total Page:16
File Type:pdf, Size:1020Kb
ECE 646 - Lecture 7 Required Reading • W. Stallings, Cryptography and Network Security, Historical Ciphers Chapter 3, Classical Encryption Techniques Part 2 • A. Menezes et al., Handbook of Applied Cryptography, Chapter 7.3 Classical ciphers and historical development 1 2 14 Substitution Ciphers (2) 12 Character frequency 2. Polyalphabetic substitution cipher 10 in a long English 8 plaintext M = m1 m2 … md 6 m m … m d+1 d+2 2d 4 m2d+1 m2d+2 … m3d 2 ….. 0 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 C = f1(m1) f2(m2) … fd(md) Character frequency 14 in the corresponding f1(md+1) f2(md+2) … fd(m2d ) 12 ciphertext f1(m2d+1 ) f2( m2d+2) … fd(m3d ) 10 for a polyalphabetic ….. 8 substitution cipher d is a period of the cipher 6 1 4 × 100% » 3.8 % Key = d, f1, f2, …, fd 26 2 d 26 d Number of keys for a given period d = (26!) » (4 × 10 ) 0 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 3 4 1 Polyalphabetic substitution ciphers Vigenère Cipher - Example Simplifications (1) Plaintext: TO BE OR NOT TO BE A. Vigenère cipher: polyalphabetic shift cipher Key: NSA Invented in 1568 Encryption: T O B E O R ci = fi mod d(mi) = mi + ki mod d mod 26 N O T T O B -1 mi = f i mod d(ci) = ci - ki mod d mod 26 E Key = k0, k1, … , kd-1 Number of keys for a given period d = (26)d 5 6 Vigenère Square Vigenère Square plaintext: 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 plaintext: 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 3 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 e f g h i j k l m n o p q r s t u v w x y z 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 e f g h i j k l m n o p q r s t u v w x y z a N S A 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 e f g h i j k l m n o p q r s t u v w x y z a b 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 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 T O B 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 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 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 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 e E O R g h i j k l m n o p q r s t u v w x y z 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 e f h i j k l m n o p q r s t u v w x y z 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 e f g N O T i j k l m n o p q r s t u v w x y z 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 e f g h T O B j k l m n o p q r s t u v w x y z 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 e f g h i k l m n o p q r s t u v w x y z 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 e f g h i j E l m n o p q r s t u v w x y z 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 e f g h i j k m n o p q r s t u v w x y z 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 e f g h i j k l G G B 1 n o p q r s t u v w x y z 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 e f g h i j k l m o p q r s t u v w x y z 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 e f g h i j k l m n R G R p q r s t u v w x y z 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 e f g h i j k l m n o q r s t u v w x y z 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 e f g h i j k l m n o p A G T r s t u v w x y z 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 e f g h i j k l m n o p q G G B 2 s t u v w x y z 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 e f g h i j k l m n o p q r t u v w x y z 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 e f g h i j k l m n o p q r s R u v w x y z 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 e f g h i j k l m n o p q r s t v w x y z 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 e f g h i j k l m n o p q r s t u w x y z 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 e f g h i j k l m n o p q r s t u v x y z 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 e f g h i j k l m n o p q r s t u v w y z 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 e f g h i j k l m n o p q r s t u v w x z 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 e f g h i j k l m n o p q r s t u v w x y 7 8 2 Vigenère Cipher - Example Determining the period of the polyalphabetic cipher ’ Plaintext: TO BE OR NOT TO BE Kasiski s method Key: NSA N S A Ciphertext: G G B R G R A G T G G B R Encryption: T O B E O R N O T Distance = 9 T O B E Period d is a divisor of the distance between G G B identical blocks of the ciphertext R G R A G T G G B In our example: d = 3 or 9 R Ciphertext: GGBRGRAGTGGBR 9 10 Index of coincidence method (1) Index of coincidence method (2) ni - number of occurances of the letter i in the ciphertext Measure of roughness: i = a .