Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer and Data Security 4th Class

Similar presentations


Presentation on theme: "Computer and Data Security 4th Class"— Presentation transcript:

1 Computer and Data Security 4th Class
lec.2

2 Symmetric algorithms Symmetric algorithms can be divide into two types Classical Algorithms and Modern Algorithms. Modern algorithms is divide into Block Cipher and Stream Cipher Classical Algorithms is divide into Substitution Cipher and Transposition Ciphers. Different cryptographic algorithms either substituted characters for one another or transposed characters with one another. The better algorithms did both. The primary change is that algorithms work on bits instead of characters. This is actually just a change in the alphabet size:from 26 elements to two elements.

3 Classical algorithms A substitution cipher is one in which each character in the plaintext is substituted for another character in the ciphertext. The receiver inverts the substitution on the ciphertext to recover the plaintext. There are four types of substitution ciphers: Monoalphabetic Substitution Cipher Polyalphabetic Substitution Cipher PolyGram Substitution Cipher Homophonic Substitution Cipher Monoalphabetic cipher or simple substitution cipher, is one in which each character of the plaintext is replaced with a corresponding character of ciphertext.

4 The famous of simple substitution ciphers are
Additive Cipher Multiplicative Cipher Affine Cipher The famous case of Additive cipher is Caesar Cipher, which can be mathematically stated as ci = pi + k(mod 26) ,and pi = ci-k (mod 26). (note: pi be the ith plaintext letter of a given message, and ci the corresponding ith ciphertext letter). If the key is equal to (3), each plaintext character is replaced by the character three to the right modulo 26 ("A" is replaced by "D," "B" is replaced by "E,"..., "W" is replaced by "Z," "X“ is replaced by "A," "Y" is replaced by "B," and "Z" is replaced by "C") is a simple substitution cipher. Decryption is accomplished by replacing each ciphertext letter with its corresponding left-shift-by-three letter.

5 In Caesar’s cipher, if the key is “3”, which is not very secure, since there is only one key-anyone who knows that the Caesar’s cipher is being used can immediately decrypt the message. 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 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

6 Additive cipher One of the most simple ciphers where the letters of the alphabet are assigned a number as depicted in Table

7

8 H.W// encrypt the following messages by using additive system.
WE WILL GO TO THE ZOO (k= 8) I AM VERY HAPPY (k= 13) I NEED SOME REST TO CONTIUNE WITH YOU (k=19) MEET ME AFTER THE PARTY (k=24)

9 Multiplicative cipher
In the multiplicative system cipher, instead of adding the key to the plaintext letter position, we simply multiply it. which can be mathematically stated as Ci = k * Pi mod 26 Plaintext a b c d e f g h i j k l m position 1 2 3 4 5 6 7 8 9 10 11 12 Multiply by 3 15 18 21 24 27 30 33 36 Mod 26 ciphertext p s v y Plaintext n o p q r s t u v w x y z position 13 14 15 16 17 18 19 20 21 22 23 24 25 Multiply by 3 39 42 45 48 51 54 57 60 63 66 69 72 75 Mod 26 2 5 8 11 ciphertext c f i l

10 The condition of multiplicative is that ,the GCD (Greatest Common Divisor ) between the key and N is one. GCD (5,10)=5, GCD (20,10)=10 If the key=13,GCD(13,26)=13, E(a)=0*13 mod 26=0=a E(b)=1*13 mod 26=13=n E(c)=2*13 mod 26=0=a , its error. How many numbers of keys in multiplicative system? Answer is 12.

11 In decryption process in multiplicative system as follow
p= (C * inv(k)) mod 26 We will define the inverse of a key k, a number inv(k)such that k . inv(k)= 1 mod 26. 3. inverse(k)=1 mod 269 Find the invers keys of the following keys

12 Affine system Affine is a word that means “linear transformation.”
The affine system is really nothing more than a combination of the multiplicative and additive. In the affine cipher system, we choose a multiplicative number k2 and additive number k1. If p is a plaintext number, then we define the cipher text number C = (ak2 + k1) mod n. where n is length of alphabet which is 26 For instance, suppose we want to encrypt the plaintext message “yes” with an affine cipher system with k2 = 5 and k1 = 20. Here are the steps: Plaintxt Y E S position 24 4 18 5P+20 140 40 110 (5P+20) mod 26 10 14 6 ciphrtext K O G

13 Why? Because ,GCD ( k2 and N) not equal 1
However, if we wanted to encrypt the plaintext “an” with an affine cipher system with k2= 2 and k1 = 8,here are the steps: Plaintext a n Position 13 2p+8 8 34 (2p+8) mod 26 Ciphertxt i Why? Because ,GCD ( k2 and N) not equal 1 The decyrption algorithm can be computed as , p = inverse (k2) (C –k1) mod 26

14 H.W WAR LOST NEED ADVICE ON ACTION TO TAKE CARE
Encrypt the following message by using multiplicative system and affine system , where k1=4 ، k2=9 . WAR LOST NEED ADVICE ON ACTION TO TAKE CARE CAESAR WAS A GREAT SOLDIER


Download ppt "Computer and Data Security 4th Class"

Similar presentations


Ads by Google