Polyalphabetic ciphers Vigenere Hill Affine Hill permutation stream
- Polyalphabetic ciphers: Vigenere, Hill, Affine Hill, permutation, stream Classical Ciphers – 3 CSCI 284 Spring 2004 GWU CS 284/Spring 04/GWU/Vora/Classical Ciphers
Vigenère Cipher Shift cipher with a different key for each letter: aeiou plaintext fgyloi key ciphertext? Decryption? VPXZGIAXIVWPUBTTMJPWIZITWZT Key: cipher 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 2
Definition: Vigenère Cipher P = C = K = (Zm)n For K = (k 1, k 2, k 3, …kn) e. K(x 1, x 2, x 3, …xn) = (x 1+k 1, x 2+k 2, x 3+k 3, …xn+kn) Alphabet is Zm, encryption done in blocks of n symbols d. K(x 1, x 2, x 3, …xn) = ? Cryptanalysis: very difficult Number of keys? Complexity of brute force? 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 3
Hill Cipher In all past ciphers, changing one symbol in plaintext changes exactly one symbol in ciphertext What if: Decryption? 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 4
Example: Hill Cipher Mod 13 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 5
Definition: Hill Cipher P = C = (Zm)n K = {all n X n invertible matrices over Zm} e. K(x) = x. K d. K(x) = x. K-1 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 6
Affine Hill Cipher Generalizes a large number of ciphers 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 7
Permutation Cipher x 1 2 3 4 5 (x) 3 2 5 1 4 x 1 2 3 4 5 -1(x) Encrypt: canwegohomenow 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 8
Definition: Permutation Cipher P = C = (Zm)n K = { | a permutation of {1, 2, …. n}} e (x 1, x 2, …xn) = (x (1), x (2), …x (n)) d (x 1, x 2, …xn) = (x -1(1), x -1(2), …x -1(n)) 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 9
Special Permutation Cipher perhaps the oldest known cipher classisboringtoday ciidlsnaabgysotrsrox What was the permutation? History 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 10
Special cases of the Affine Hill cipher • Permutation • Affine • Shift Show 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 11
Stream Ciphers • Message does not consist of words of symbols, but an (unending) stream of symbols. • A key stream (not a single key) encrypts the stream of symbols y 1 y 2… = ez 1(x 1)ez 2(x 2)… Synchronous: when keystream generated by a key, independent of plaintext z 1, z 2, … = g(K) 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 12
Definition: Synchronous Stream Cipher P: plaintext C: ciphertext K: keyspace (so far exactly that in block ciphers) L: keystream alphabet g: keystream generator z 1, z 2, … = g(K) where K K, and zi L ezi: P C d zi : C P dzi(ezi(x)) = x 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 13
Examples from ciphers we have already seen? • Shift? Affine? Hill? Affine Hill? Substitution? Vigenère? Permutation? 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 14
Periodic Stream Cipher? • Security? • Binary addition as XOR, easy to implement in hardware. • Encryption and decryption are the same operations: addition of the bit 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 15
Example: Linear recurrence Prob 1. 18 and 1. 19 (text) zi+4 = (zi + zi+1 + zi+2 + zi+3) mod 2 Of degree 4. Why linear? Start with some z 1, z 2, z 3, z 4 0101001 Period? Security? Try two other initialization vectors Same with zi+4 = (zi + zi+3) mod 2 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 16
Hardware implementation Linear Feedback Shift Register (LFSR) Key = (c 0, c 1, …cm-1, z 0, z 1, …zm-1) zi+m Delay …. Delay Cm-1 Cm-2 Delay C 1 …. zi C 0 zi+m = j=0 m-1 cizi+j m 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 17
Shrinking Generator Y = f(X, Z) / * X, Y, Z, random-number sequences */ /* X and Z from a LFSR with different keys */ j : = 0 For every i If (Xi == 1) /* Clock is ON */ Yj = Zi /* Output other sequence */ j +=1 Endif End i Disadvantage? 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 18
Shrinking Generator: Examples 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 19
Stop-and-go Generator Y = f(X, Z) x_pos = 0; /* mark stop position */ Forall i If(Zi == 1) /* Go. */ x_pos += 1 Endif Yi : = Xx_pos /* Hold onto output value */ End i 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 20
Examples 1/21/2022 CS 284/Spring 04/GWU/Vora/Classical Ciphers 21
- Slides: 21