0% found this document useful (0 votes)
106 views24 pages

cns19 Lec

The document discusses various classical ciphers including monoalphabetic ciphers like the shift cipher, multiplicative cipher, and affine cipher. It then covers polyalphabetic ciphers such as the autokey cipher, Vigenère cipher, and Playfair cipher. It provides examples of encrypting messages using these ciphers and discusses their encryption and decryption methods.

Uploaded by

Zaid Naeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views24 pages

cns19 Lec

The document discusses various classical ciphers including monoalphabetic ciphers like the shift cipher, multiplicative cipher, and affine cipher. It then covers polyalphabetic ciphers such as the autokey cipher, Vigenère cipher, and Playfair cipher. It provides examples of encrypting messages using these ciphers and discusses their encryption and decryption methods.

Uploaded by

Zaid Naeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Cryptography &

Network Security
Lec#5

Dr M Imran
CNS19-QUIZ#1
Time: 10 min
Marks: 10
Traditional
Symmetric-Key
Ciphers…cont’d

3.3
Classical Ciphers
 Substitution Ciphers
 Mono alphabetic ciphers
 Poly alphabetic ciphers
 Transposition Ciphers
Mono alphabetic ciphers

 Shift/ Additive Cipher


 Multiplicative cipher
 Affine cipher

Affine Ciphers

The affine cipher uses a pair of keys in which the first key is from
Z26* and the second is from Z26. The size of the key domain is:-
3.6
26 × 12 = 312.
Example: Affine cipher
Use an affine cipher to encrypt the message “hello” with the key
pair (7, 2).

Use the affine cipher to decrypt the message “ZEBBW” with the
key pair (7, 2) in modulus 26.

The additive cipher is a special case of an affine cipher in which


k1 =3.7 1. The multiplicative cipher is a special case of affine cipher in
which k2 = 0.
Cryptanalysis of Affine cipher

 C= ((P x k1) + k2) mod 26


 P= ((C – k2) x k1-1) mod 26
 - k2 is AI & k1-1 is MI
 k1 is from Z 26* , k2 is from Z26
 Size of key domain is 26 x 12
 brute force &
 chosen plain text attack
C = P K  K = P-1C
Monoalphabetic substitution Cipher
 Additive, multiplicative and affine ciphers have very
small key domains.
 The keys used in these ciphers are independent of
the plaintext and ciphertext charecters.
 each plaintext letters are encrypted with the same key
chosen from Z26 or Z*26
 Monoalphabetic substitution
cipher maps plaintext letter with
randomly selected letter.
 Sender and receiver can agree on
a table showing a mapping of each
plaintext char
Monoalphabetic Permutation Key Cipher
 The key is 26 letters long, one table shown below

We can use the above key to encrypt the message

Into ciphertext as
Monoalphabetic substitution
Cipher
 now have a total of 26! = 4 x 1026 keys
 with so many keys, might think is secure
 but would be !!!WRONG!!!
 problem is language characteristics
Polyalphabetic Ciphers

 polyalphabetic substitution ciphers


 improve security using multiple cipher
alphabets for same plaintext alphabet
Poly-alphebatic Ciphers

 Autokey ciphers
 Vigenere cipher
 Playfair cipher
 Hill Cipher
Autokey Cipher
 In this cipher, the key is a stream of sub keys, in
which each sub key is used to encrypt the
corresponding character in the plaintext.
 The first sub key is a predetermined value
chosen from Z26
 use plaintext as remaining sub keys i.e.
 The 2nd, 3rd, 4th, … sub keys are the values of the
1st,2nd,3rd,4th, 5th,….plaintext charters, repectivly.
 P=P1P2P3P4…… C=C1C2C3C4…..
k=k1,P1P2P3P4
 Encryption: Ci=(Pi+ki)mod 26
 decryption: Pi=(Ci-ki)mod 26
Vigenère Cipher
 In this cipher, an initial key stream of
length m is decided. K = k1 k2 ... km
 The key stream is made up by repetition of
initial key stream.
 Encryption and decryption is done as in
additive key cipher.
Example of Vigenère Cipher
 write the plaintext out
 write the keyword repeated above it
 use each key letter as a shift cipher key
 encrypt the corresponding plaintext letter
 eg using keyword deceptive
key: deceptive
plaintext: we are discovered save
yourself

ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Vigenere cipher can be seen as combinations of m additive ciphers.

3.19
Playfair Key Matrix
 The key is 26 alphabets letters arranged in
a 5X5 matrix of letters
 Different arrangements of the letter
creates different keys
Playfair Key Matrix
 based on a keyword
 fill in letters of keyword (sans duplicates)
 fill rest of matrix with other letters
 eg. using the keyword MONARCHY

M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Encrypting and Decrypting
 plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’
2. if both letters fall in the same row, replace
each with letter to right (wrapping back to start
from end)
3. if both letters fall in the same column, replace
each with the letter below it (again wrapping to
top from bottom)
4. otherwise each letter is replaced by the letter
in the same row and in the column of the other
letter of the pair
Encrypting and Decrypting
 plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’
2. if both letters fall in the same row, replace
each with letter to right (wrapping back to start
from end)
3. if both letters fall in the same column, replace
each with the letter below it (again wrapping to
top from bottom)
4. otherwise each letter is replaced by the letter
in the same row and in the column of the other
letter of the pair
3.2.2 Continued
Playfair Cipher
Figure 3.13 An example of a secret key in the Playfair cipher

Example 3.15
Let us encrypt the plaintext “hello” using the key in Figure 3.13.

3.24

You might also like