0% found this document useful (0 votes)
25 views35 pages

Classical Encryption Techniques: Dr. Rajkumar Tekchandani Assistant Professor - CSED

Uploaded by

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

Classical Encryption Techniques: Dr. Rajkumar Tekchandani Assistant Professor - CSED

Uploaded by

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

Classical Encryption Techniques

Dr. Rajkumar Tekchandani


Assistant Professor | CSED

Cryptography & Network Security | Ethical


Hacking
Classical Substitution Ciphers
• Where letters of plaintext are replaced by other letters or by numbers or symbols

• or if plaintext is viewed as a sequence of bits, then substitution involves replacing


plaintext bit patterns with ciphertext bit patterns

Cryptography & Network Security | Ethical


Hacking
Caesar Cipher
• Earliest known substitution cipher by Julius Caesar

• First attested use in military affairs

• Replaces each letter by 3rd letter on

• Example:
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB

Cryptography & Network Security | Ethical


Hacking
Caesar Cipher continued..
• Can define transformation as:
abcdefghijklmnopqrstuvwxyz
DEFGHI J KLM NOPQRSTUVWXYZABC

• Mathematically give each letter a number


abcdefghij 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 13 14 15 16 17 18 19 20 21 22 23 24 25

• Then we have a Caesar cipher as:


c = E(p) = (p + k) mod (26)
p = D(c) = (c – k) mod (26)

Cryptography & Network Security | Ethical


Hacking
Cryptanalysis of Caesar Cipher
• Only have 26 possible ciphers
– A maps to A,B,..Z
• Could simply try each in turn
• A brute force search
• Given ciphertext, just try all shifts of letters
• Do need to recognize when have plaintext
• eg. break ciphertext "GCUA VQ DTGCM"

Cryptography & Network Security | Ethical


Hacking
Monoalphabetic Cipher
• Rather than just shifting the alphabet we could shuffle (jumble) the letters arbitrarily

• Each plaintext letter maps to a different random ciphertext letter

• Hence key is 26 letters long

Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN

Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

Cryptography & Network Security | Ethical


Hacking
Monoalphabetic Cipher Security
• Now we have a total of 26! = 4 x 1026 keys
• With so many keys, might think is secure but would be !!!WRONG!!!
• The problem is language characteristics

Cryptography & Network Security | Ethical


Hacking
Language Redundancy and Cryptanalysis
• Human languages are redundant
• eg "th lrd s m shphrd shll nt wnt"
• Letters are not equally commonly used
• In English E is by far the most common letter
– followed by T,R,N,I,O,A,S
• Other letters like Z,J,K,Q,X are fairly rare
• Have tables of single, double & triple letter frequencies for various languages

Cryptography & Network Security | Ethical


Hacking
English Letter Frequencies

Cryptography & Network Security | Ethical


Hacking
Use in Cryptanalysis
• key concept - monoalphabetic substitution ciphers do not change
relative letter frequencies
• discovered by Arabian scientists in 9th century
• calculate letter frequencies for ciphertext
• compare counts/plots against known values
• if caesar cipher look for common peaks/troughs
– peaks at: A-E-I triple, NO pair, RST triple
– troughs at: JK, X-Z
• for monoalphabetic must identify each letter
– tables of common double/triple letters help

Cryptography & Network Security | Ethical


Hacking
Polyalphabetic Ciphers
• Polyalphabetic substitution 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

Cryptography & Network Security | Ethical


Hacking
Playfair Cipher

Dr. Rajkumar Tekchandani


Assistant Professor | CSED

Cryptography & Network Security | Ethical


Hacking
Playfair Cipher
• Not even the large number of keys in a monoalphabetic cipher provides security

• One approach to improve 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

Cryptography & Network Security | Ethical


Hacking
Playfair Key Matrix
• A 5X5 population matrix of letters based on a keyword.

• Fill in letters of keyword (Eliminates 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

Cryptography & Network Security | Ethical


Hacking
Encrypting and Decrypting a playfair cipher
Plaintext is encrypted using two letters at a time
1. If a pair is a repeated letter, insert filler like 'X’, [balloon→ba lx
lo on] | OR if pair is not complete.

2. If both letters fall in the same row, replace each with letter to
right (wrapping back to start from end) [AR→RM] M O N A R
C H Y B D
3. If both letters fall in the same column, replace each with the
letter below it (again wrapping to top from bottom) [PV→VO] E F G I/J K
L P Q S T
4. Replacement with diagonally opposite letter, if pair falls in U V W X Z
different row or column. Note: Order must be preserved.
[OY→NH, BZ→DX]

5. Decryption is just reverse of this.


Cryptography & Network Security | Ethical
Hacking
Security of Playfair Cipher
• Security much improved over monoalphabetic

• Since have 26 x 26 = 676 digrams

• Would need a 676 entry frequency table to analyse (verses 26 for a monoalphabetic)

• Was widely used for many years


– eg. by US & British military in WW1

• It can be broken, given a few hundred letters

• Since still has much of plaintext structure

Cryptography & Network Security | Ethical


Hacking
Hill Cipher

Dr. Rajkumar Tekchandani


Assistant Professor | CSED

Cryptography & Network Security | Ethical


Hacking
Hill Cipher [PK mod 26]

Cryptography & Network Security | Ethical


Hacking
Encryption [E (P,K)]

Cryptography & Network Security | Ethical


Hacking
Hill Cipher Decryption

Dr. Rajkumar Tekchandani


Assistant Professor | CSED
Cryptography & Network Security | Ethical
Hacking
Decryption of Hill Cipher [D(K,C)]

Cryptography & Network Security | Ethical


Hacking
continued..

Cryptography & Network Security | Ethical


Hacking
continued..

Cryptography & Network Security | Ethical


Hacking
continued..

Cryptography & Network Security | Ethical


Hacking
continued..

Cryptography & Network Security | Ethical


Hacking
Vigenère Cipher
• simplest polyalphabetic substitution cipher
• effectively multiple caesar ciphers
• key is multiple letters long K = k1 k2 ... kd
• ith letter specifies ith alphabet to use
• use each alphabet in turn
• repeat from start after d letters in message
• decryption simply works in reverse

Cryptography & Network Security | Ethical


Hacking
Process of Vigenere Cipher
The sender and the receiver decide on a key. Say ‘point’ is the key. Numeric representation of this key is
‘16 15 9 14 20’.

The sender wants to encrypt the message, say ‘attack from south east’. He will arrange plaintext and
numeric key as follows −

He now shifts each plaintext alphabet by the number written below it to create ciphertext as shown below

Cryptography & Network Security | Ethical


Hacking
Security of Vigenère Ciphers
• Have multiple ciphertext letters for each plaintext letter

• Hence letter frequencies are obscured but not totally lost.

Cryptography & Network Security | Ethical


Hacking
One-Time Pad
• if a truly random key as long as the message is used, the cipher will be secure
• called a One-Time pad
• is unbreakable since ciphertext bears no statistical relationship to the plaintext
• since for any plaintext & any ciphertext there exists a key mapping one to other
• can only use the key once though
• problems in generation & safe distribution of key

Cryptography & Network Security | Ethical


Hacking
Transposition ciphers

Dr. Rajkumar Tekchandani


Assistant Professor | CSED

Cryptography & Network Security | Ethical


Hacking
Transposition Ciphers
• Now consider classical transposition or permutation ciphers

• These hide the message by rearranging the letter order without altering the actual
letters used

Cryptography & Network Security | Ethical


Hacking
Rail Fence cipher
• Write message letters out diagonally over a number of rows
• Then read off cipher row by row
• eg. write message out as:

M E M A T R H P R Y
E T E F E T E A T

me ma t r h pry
e t e f e t e at

• Giving ciphertext
me ma t r h prye t e f e t e at

Cryptography & Network Security | Ethical


Hacking
Row Transposition Ciphers
• 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

Key: 3421567

Plaintext: a t t a c k p
ostpone
duntilt
woamxyz

Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ

Cryptography & Network Security | Ethical


Hacking
Product Ciphers
• Ciphers using substitutions or transpositions are not secure because of language
characteristics

• Hence we consider using several ciphers in succession to make harder, but:


– two substitutions make a more complex substitution
– two transpositions make more complex transposition
– but a substitution followed by a transposition makes a new much harder cipher

• This is bridge from classical to modern ciphers [Fiestal Cipher]

Cryptography & Network Security | Ethical


Hacking
Summary
• We have considered:

– Classical cipher techniques and terminology


– Monoalphabetic substitution ciphers
– Cryptanalysis using letter frequencies
– Playfair cipher
– Hill cipher
– Polyalphabetic ciphers
– Transposition ciphers
– Product ciphers

Cryptography & Network Security | Ethical


Hacking

You might also like