110 likes | 412 Views
Lecture 2 Classical Cipher System SIMPLE SUBSTITUTION CIPHERS. By: NOOR DHIA AL- SHAKARCHY 2012-2013. 2- SIMPLE SUBSTITUTION CIPHERS :.
E N D
Lecture 2Classical Cipher SystemSIMPLE SUBSTITUTION CIPHERS By: NOOR DHIA AL- SHAKARCHY 2012-2013
2- SIMPLE SUBSTITUTION CIPHERS: In simple substitution (or mono alphabetic) ciphers, each character of the plaintext replaced with a corresponding character of ciphertext. A single one-to-one mapping function (f) from plaintext to ciphertext character is used to encrypt the entire message using the same key (k); such that: Ek(M) = F(m1) F(m2) … ..F(mN) =C Where: N : is the length of the message. M : is plaintext message given by M = ( m1, m2, … ..,mN). C : is ciphertext message given by C = (c1,c2,… .., cN). There are many types of simple substitution ciphers according to its equations used to encryption, they: • Shifted alphabet (Caesar cipher): F(a) = (a + k) mod n Where k : is the number of positions to be shifted. a : is a single character of the alphabet> n : is the size of the alphabet.
2- SIMPLE SUBSTITUTION CIPHERS: Example: If k =3 then we can encrypt the following message as: M = R E N A I S S A N C E Ek(M) = U H Q D L V V D Q F H • Multiplication based (decimation): F(a) = ak mod n Where k, n are relatively prime in order to produce a complete set of residues. Example: If k =9 then the above message can encrypted as: M = R E N A I S S A N C E Ek(M) = X K N A U G G A N S K If k and n are not relatively prime, several letters will encipher to the same ciphertext letter, and not all letters will appear in the ciphertext.
2 - SIMPLE SUBSTITUTION CIPHERS: • Addition and multiplication (affine): F(a) = (ak1+k0) mod n Where k1 and n are relatively prime Simple substitution ciphers dose not hide the underlying frequencies of the different letters of the plaintext, and hence it can be easily broken. Example: Encrypt the following message using Caesar and decimation methods of simple substitution Ciphers when k=13 and alphabet A … Z: M = RENAISSANCE First we give the position of each character in alphabet. A -0 G -6 M – 12 S – 18 Y -24 B -1 H -7 N - 13 T - 19 Z -25 C -2 I -8 O - 14 U -20 D -3 J -9 P - 15 V – 21 E -4 K -10 Q -16 W - 22 F -5 L - 11 R -17 X - 23 Then we obtained the equation with k =13 and n =26: • Shifted alphabet (Caesar): F (a) = (a+k) mod n F (R) = (17 + 13) mod 26 = 30 mod 26 = 4 =E F (E) = (4 + 13) mod 26 = 17 mod 26 =17 = R F (N) = (13 +13) mod 26 = 26 mod 26 =0 =A And so on
2 - SIMPLE SUBSTITUTION CIPHERS: • Multiplication based (decimation): We can't encrypted because k and n are not relatively prime (GCD (13, 26) =13 not 1) That’s mean: F (A) = 0 * 13 mod 26 = 0 = A F(C) = 2 * 13 mod 26 = 0 = A F (E) = 4 * 13 mod 26 = 0 = A This is meaning the characters A, C and E encrypted to same letter A.
3- HOMOPHONIC SUBSTITUTION CIPHERS: A homophonic substitution cipher maps each character a of the plaintext alphabet in to a set of Ciphertext elements f(a) called homophonies. High- order homophones: Example: Let n=5, alphabet= {E, I, L,M,S}, M= SMILE, X= K= LIMES. Find C. Matrix=5*5= 25 numbers= 01,……,25. C= 21 16 05 19 11
4-POLYALPHABETIC SUBSTITUTION CIPHERS: • Vigener cipher : The key is specified by a sequence of the letters= k1,k2,……..,kd, where ki (i=1,2,….,d) gives the amount of shift in the ith alphabet that is: F(a) = (a + ki) mod n Where ki : is the number of positions to be shifted in the ith alphabet. a : is a single character of the alphabet. n : is the size of the alphabet. Example: we can encrypt the following message and key as: M = R E N A I S S A N C E K = B A N D B A N D B A NEk(M) = S E A D J S F D O C R
4-POLYALPHABETIC SUBSTITUTION CIPHERS: • Beaufort cipher : This cipher similar to Vigener cipher ,where, The key is specified by a sequence of the letters, K=k1,k2,……..,kd, where ki(i=1,2,….,d) gives the amount of shift in the ith alphabet except the shifted is begin with 25in it's table that is: F(a) = (ki-ai) mod n Where ki : is the number of positions to be shifted in the ith alphabet. a : is a single character of the alphabet. n : is the size of the alphabet. Example: we can encrypt the following message and key as: M = R E N A I S S A N C E K = B A N D B A N D B A NEk(M) =
4-POLYALPHABETIC SUBSTITUTION CIPHERS: • Variant Beaufort cipher : This cipher is the reversal of vigener cipher, and when used one to encryption the other is used to decryption and vice versa. Such that is: F(ai) = (ai-ki) mod n Where ki : is the number of positions to be shifted in the ith alphabet. a : is a single character of the alphabet. n : is the size of the alphabet. Example: we can encrypt the following message and key as: M = R E N A I S S A N C E K = B A N D B A N D B A NEk(M) =