The Vignere Cipher 1. Choose a key, say turing 2. Choose a plaintext, say hello class 3. Write both in columns, repeating the key as necessary 4. To encrypt, add the positional equivalents of each character in the plain text to the positional equivalents of each character in the key and mod by 26. This is the positional value of the encrypted character. 5. To decrypt, subtract the positional equivalents of each character in the key from each character in the cipher text and mod by 26. This is the positional value of the decrypted characters Key Plain computation text (7 + 19) % 26 = 0 t h (4+ 20) %26 = 24 u e (11+ 17) % 26 =2 r l (11 + 8) % 26 = 19 i l (14+ 13) % 26 =1 n o Etc g c t l u a r s i s Cipher computation text (0 – 19) % 26 = 7i a (24 – 20) % 26 = 4 y Etc. c t b New plain text h e 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 0 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 24 25 13 23 So: encrypt(Cj) = (Cj + Kj) mod 26 where Cj is the positional equivalent of the jth character in the character sequence and Kj is the positional equivalent of the jth character in the key after the key is lined up next to the plaintext decrypt(Cj) = (Cj – Kj) mod 26 where Where Cj and Kj are as defined above To use a Vignere Square: Encryption 1. Read across to the column labeled by the key character 2. Read down to the row labeled by the plaintext character 3. The intersection of row and col is the ciphertext character Decryption 1. Read across to the column labeled by the key character 2. Read down until you find the ciphertext character 3. The label of the row in which the ciphertext character was found is the plaintext character How large is the key space? Another Variation 1. Instead of merely shifting the alphabets to the right as we proceed down the rows, permute them 2. What does this do to the encrypt/decrypt algorithm that uses modular arithmetic? 3. How large is the key space? i This works because of the mathematical definition of congruence. Under certain circumstances, -19 and 7 have a particular relationship with another. They are congruent mod 26. Only if you are interested, read on. Def. Let a, b, n be integers with a ≠ 0. We says that a ≡ b % n if a – b is a multiple, m, of n. So, 7 ≡ 12 % 5 Th. Let x, y, n, p be integers. If x ≡ y % n then x ≡ y + pn % n. So, 7 ≡ (12 + 2 * 5) % 5
© Copyright 2024 ExpyDoc