Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
46 views20 pages

Lecture 1.4

The document discusses various classical encryption techniques including substitution ciphers like Caesar cipher and monoalphabetic cipher, transposition ciphers like rail fence cipher and columnar transposition cipher, and polyalphabetic ciphers like Playfair cipher, Vigenere cipher and Hill cipher. It also discusses the concepts of one-time pad.

Uploaded by

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

Lecture 1.4

The document discusses various classical encryption techniques including substitution ciphers like Caesar cipher and monoalphabetic cipher, transposition ciphers like rail fence cipher and columnar transposition cipher, and polyalphabetic ciphers like Playfair cipher, Vigenere cipher and Hill cipher. It also discusses the concepts of one-time pad.

Uploaded by

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

Cryptography & Network Security

Subject Code: KCS074

Pankaj Kumar
Assistant Professor

Department of Computer Science & Engineering


Pranveer Singh Institute of Technology, Kanpur, India

October 28, 2023


Classical Encryption Techniques

• Substitution Cipher Technique

• Transposition Cipher Technique

Pankaj Kumar October 28, 2023 2/20


Substitution Cipher Technique

• A substitution cipher replaces one symbol with another.

• A substitution cipher replaces one symbol with another.


• Substitution ciphers can be categorized as:
• Caesar Cipher
• Monoalphabetic Cipher
• Playfair Cipher
• Hill Cipher
• Polyalphabetic Cipher
• One time pad

Pankaj Kumar October 28, 2023 3/20


Caesar Cipher

• Earliest known substitution cipher by Julius Caesar.

• Replaces each letter by 3rd letter on.


Example:
Input: MEET ME AFTER THE TAGO PARTY
Output: PHHW PH DIWHU WKH WRJD SDUWB
C = E (P) = (P + K )mod(26)
P = D(C ) = (C –K )mod(26)

Pankaj Kumar October 28, 2023 4/20


Monoalphabetic Cipher

• Rather than just shifting the alphabet.

• Could shuffle (jumble) the letters arbitrarily.

• Each plaintext letter maps to a different random ciphertext letter.

• Hence, key is 26 letters long.


EXAMPLE:
Input: Plaintext: ifwewishtoreplaceletters
Output: Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

Pankaj Kumar October 28, 2023 5/20


Playfair Cipher

• One approach to improving security was to encrypt multiple letters.


• The Playfair Cipher is an example.
• Invented by Charles Wheatstone in 1854, but named after his friend
Baron Playfair.
• A 5X5 matrix of letters based on a keyword.
• Fill in letters of keyword (sans duplicates).
• Fill rest of matrix with other letters.
• EXAMPLE: using the keyword MONARCHY.

Pankaj Kumar
Figure: PlayfairOctober
cipher28, 2023 6/20
Encryption and Decryption

Plaintext is encrypted two letters at a time.


1 If a pair is a repeated letter, insert filler like ’X’. Example: ”BALLOON”
encrypts as ”BA LX LO ON”
2 If both letters fall in the same row, replace each with letter to right
(wrapping back to start from end). Example: AR is encrypted as RM
3 If both letters fall in the same column, replace each with the letter
below it (again wrapping to top from bottom) MU is encrypted as CM

4 Otherwise, each letter is replaced by the letter in the same row and in
the column of the other letter of the pair. Thus, HS becomes BP and
EA becomes IM (or JM, as encipherer wishes).

Pankaj Kumar October 28, 2023 7/20


Polyalphabetic Ciphers

• Improve security using multiple cipher alphabets


• Make cryptanalysis harder with more alphabets to guess and flatter
frequency distribution
• Use a key to select which alphabet is used for each letter of the message

• Use each alphabet in turn


• Repeat from start after end of key is reached
• Best algorithm used Vigenere cipher

Pankaj Kumar October 28, 2023 8/20


Polyalphabetic Ciphers

Vigenere Cipher
• Simplest polyalphabetic substitution cipher
• Effectively multiple caesar ciphers
• Key is multiple letters long K = k1 k2 ...kd
• i th letter specifies i th alphabet to use
• Use each alphabet in turn
• Repeat from start after d letters in message
• Decryption simply works in reverse

Pankaj Kumar October 28, 2023 9/20


Example of Vigenere Cipher

• write the plaintext out


• write the keyword repeated above it
• use each key letter as a caesar cipher key
• encrypt the corresponding plaintext letter
Example: Using keyword deceptive
Key: deceptivedeceptivedeceptive Plaintext: wearediscoveredsaveyourself
Ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Pankaj Kumar October 28, 2023 10/20


Hill Cipher

Take m successive plaintext and substitute for m successive cipher text


letter.
For m = 3, the system can be described as follows:
c1 = (k11 p1 + k12 p2 + k13 p3 )mod(26)
c2 = (k21 p1 + k22 p2 + k23 p3 )mod(26)
c3 = (k31 p1 + k32 p2 + k33 p3 )mod(26)
Where c and p are column vectors of length 3, representing the plaintext and
ciphertext, respectively and K is a 3 x 3 matrix, representing the encryption
key. Operations are performed mod26.

Pankaj Kumar October 28, 2023 11/20


Example of Hill Cipher

The plaintext “code is ready” can make a 3 Ö 4 matrix when adding extra
bogus character “z” to the last block and removing the spaces. The cipher-
text is “OHKNIHGKLISS”.

Pankaj Kumar October 28, 2023 12/20


One-Time Pad

• If a truly random key as long as the message is used, the cipher will be
secure
• Key is to be used to encrypt and decrypt a single message, and then is
discarded.
• Each new message requires a new key of the same length as the new
message.
• Such a scheme, known as a one-time pad, is unbreakable.
• It produces random output that bears no statistical relationship to the
plaintext. Because the ciphertext contains no information whatsoever
about the plaintext, there is simply no way to break the code.
• Problems in generation and safe distribution of key

Pankaj Kumar October 28, 2023 13/20


Transposition Cipher

• A transposition cipher does not substitute one symbol for another,


instead it changes the location of the symbols.
• A transposition cipher reorders symbols.
• Types:
• Rail Fence
• Columnar transposition
• Double transposition

Pankaj Kumar October 28, 2023 14/20


Transposition Cipher- Rail Fence Cipher

• Simple transposition ciphers, which were used in the past, are keyless.
• A good example of a keyless cipher using the first method is the rail
fence cipher.
• The ciphertext is created reading the pattern row by row.
• Example: To send the message “Meet me at the park” to Bob, Alice
writes.

The ciphertext is “MEMATEAKETETHPR”.

Pankaj Kumar October 28, 2023 15/20


Row Transposition Cipher

• A more complex transposition.


• Write letters of message out in rows over a specified number of columns.
• Then reorder the columns according to some key before reading off the
rows.
• Example: ATTACK POSTPONED UNTIL THE ORDER.
Key: 4 3 1 2 5 6 7 Plaintext:
ATTACKP
OSTPONE
DUNTILT
HEORDER
Ciphertext:TTNOAPTRTSUEAODHCOIDKNLEPETR

Pankaj Kumar October 28, 2023 16/20


Transposition Cipher (Columner Cipher)

• Alice and Bob can agree on the number of columns and use the second
method.
• Alice writes the same plaintext, row by row, in a table of four columns.

The ciphertext is “MMTAEEHREAEKTTP”.

Pankaj Kumar October 28, 2023 17/20


Transposition Cipher (Columner Cipher)

EXAMPLE:

Pankaj Kumar October 28, 2023 18/20


Transposition Cipher (Double Columner cipher)

Double Transposition Cipher:

Pankaj Kumar October 28, 2023 19/20


Thank You!

Pankaj Kumar October 28, 2023 20/20

You might also like