0% found this document useful (0 votes)
3 views

Lecture 2-Advance Cryptography-1

The lecture covers advanced topics in cryptography, including symmetric and asymmetric encryption, hash functions, and authentication mechanisms. It discusses various classical encryption techniques such as the Caesar cipher, mono-alphabetic ciphers, and the Playfair cipher, along with their cryptanalysis methods. The session also introduces the symmetric cipher model, key management techniques, and the principles of cryptanalysis, including brute-force and non-brute-force attacks.

Uploaded by

Shaheer Khan
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)
3 views

Lecture 2-Advance Cryptography-1

The lecture covers advanced topics in cryptography, including symmetric and asymmetric encryption, hash functions, and authentication mechanisms. It discusses various classical encryption techniques such as the Caesar cipher, mono-alphabetic ciphers, and the Playfair cipher, along with their cryptanalysis methods. The session also introduces the symmetric cipher model, key management techniques, and the principles of cryptanalysis, including brute-force and non-brute-force attacks.

Uploaded by

Shaheer Khan
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/ 44

ADVANCE CRYPTOGRAPHY-1

LECTURE # 2
DR. MADIHA KHALID
OVERVIEW LECTURE 1
OVERVIEW OF THE COURSE

Cryptography Symmetric Asymmetric


Hash Functions
Basics Cryptography Cryptography
Authentication
Mechanisms
1. DES &
1. Security
2. AES 1. Diffie- 1. SHA Key Management
basics
3. RC4 Hellman 2. MD-5 Techniques
2. Classical
4. LFSR 2. RSA
encryption
5. SEAL
AGENDA-WEEK 2

 Symmetric cipher model


 Substitution techniques
 Transposition techniques
 Rotor machines
 Steganography
AGENDA-WEEK 2

 Symmetric cipher model


 Substitution techniques
 Transposition techniques
 Rotor machines
 Steganography
BASIC TERMS

 plaintext - original message


 ciphertext - coded message
 cipher - algorithm for transforming plaintext to
ciphertext
 key - info used in cipher known only to sender/receiver
 encipher (encrypt) - converting plaintext to
ciphertext
 decipher (decrypt) - recovering ciphertext from
plaintext
 cryptography - study of encryption principles/methods
 cryptanalysis (codebreaking) - study of principles/
methods of deciphering ciphertext without knowing key
 cryptology - field of both cryptography and
cryptanalysis
SYMMETRIC CIPHER MODEL

 Plain text
 Encryption algorithm
 Secret key
 Cipher text
 Decryption algorithm
SYMMETRIC CIPHER MODEL
http://www.mathstat.dal.ca/~dilcher/4116/Portraits/speedbump21044350010716.gif

Requirements for secure convention\symmetric encryption


1. The opponents should be unable to decrypt ciphertexts
or discover key even if it has (cipher text, plain text)
pairs and algorithm understanding.
2. Secret key must be protected. If the attacker discovers
the key and knows the algorithm, all the cipher texts
become readable.
SYMMETRIC CIPHER MODEL

 Mathematically:
Y = EK(X) or Y = E(K, X)
X = DK(Y) or X = D(K, Y)
 X = plaintext
 Y = ciphertext
 K = secret key
 E = encryption algorithm
 D = decryption algorithm
 Both E and D are known to public
 Cryptanalyst estimates X and/or K based on the
algo and Y.
CRYPTOGRAPHY

Type of operation Nature of keys Plaintext processing

Block Stream
Substitution Transposition Symmetric Asymmetric
ciphers ciphers
CRYPTANALYSIS

 Objective: to recover the plaintext of a ciphertext or, more typically, to


recover the secret key.

 Kerckhoff ’s principle: the adversary knows all details about a


cryptosystem except the secret key.

 Two general approaches:


 brute-force attack
 non-brute-force attack (cryptanalytic attack)
BRUTE FORCE ATTACK
 Try every key to decipher the ciphertext.
 On average, need to try half of all possible keys
 Time needed proportional to size of key space
 Effective in combination with known plain text attack

Key Size (bits) Number of Alternative Time required at 1 Time required at 106
Keys decryption/µs decryptions/µs
32 232 = 4.3  109 231 µs = 35.8 minutes 2.15 milliseconds

56 256 = 7.2  1016 255 µs = 1142 years 10.01 hours

128 2128 = 3.4  1038 2127 µs = 5.4  1024 years 5.4  1018 years

168 2168 = 3.7  1050 2167 µs = 5.9  1036 years 5.9  1030 years

26 characters 26! = 4  1026 2  1026 µs = 6.4  1012 years 6.4  106 years
(permutation)
CRYPTANALYTIC ATTACKS

Example
In 1942, US Navy cryptanalysts
Encryption CT (PT,CT) (chosen (PT, discovered that Japan was
Algo PT,CT) chosen planning an attack on “AF”.
CT) They believed that “AF” means
Cipher text only √ √ Midway island.
Pentagon didn’t think so.
Known plain text √ √ √
US forces in Midway sent a
Chosen plain text √ √ √ plain message that their
Chosen cipher text √ √ √ freshwater supplies were low.
Shortly, US intercepted a
Chosen text √ √ √ √ Japanese ciphertext saying that
“AF” was low on water.
**PT=Plain Text; CT= Cipher text This proved that “AF” is
Midway.
CRYPTANALYTIC ATTACKS

 Unconditional security
no matter how much computer power or time is available, the cipher cannot be broken since the ciphertext
provides insufficient information to uniquely determine the corresponding plaintext
 Computational security
given limited computing resources (eg time needed for calculations is greater than age of universe), the cipher
cannot be broken
CLASSICAL ENCRYPTION TECHNIQUES

Type of operation

Substitution Transposition

Ceasar Rail Fence

Mono-alphabetic Columnar
Transposition
Playfair

Poly-alphabetic
CEASAR CIPHER

 Earliest known substitution cipher


 Invented by Julius Caesar Example:
 Each letter is replaced by the letter X(three) positions further or shifted down Plain text: Attack
the alphabet. Cipher text: Dwwdfn
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: 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
CEASAR CIPHER

 Mathematically, map letters to numbers:


a, b, c, ..., x, y, z
0, 1, 2, ..., 23, 24, 25
 Then the general Caesar cipher is:
c = EK(p) = (p + k) mod 26
p = DK(c) = (c – k) mod 26
CEASAR CIPHER-CRYPTANALYSIS

 Key space: {0, 1, ..., 25}


 Vulnerable to brute-force
attacks.
 Need to recognize it when
have the plaintext
 What if the plaintext is written
in Korean or …?
MONO-ALPHABETIC CIPHER

 The super set of keys comprises of 26! Permutations of English alphabets.


 Discourages brute force attack
 Examples
PT : larger key size means greater security
CT : WKJHV JUVZO DGVQV KNOHJ VKIVJ OVPXJ DIZ
MONO-ALPHABETIC CIPHER-CRYPTANALYSIS

 Now we have a total of 26! = 4 x 1026 keys.

 With so many keys, it is secure against brute-force


attacks.

 But not secure against some cryptanalytic attacks.

 Human languages are not random.

 Letters are not equally frequently 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.


MONO-ALPHABETIC CIPHER-CRYPTANALYSIS

 Statistics for double & triple letters in English


language
Key concept:
monoalphabetic substitution does not
change relative letter frequencies

To attack, we
1. calculate letter frequencies
for ciphertext
2. compare this distribution
against the known one
MONO-ALPHABETIC CIPHER-CRYPTANALYSIS

 Given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ P 13.33 H 5.83 F 3.33 B 1.67 C 0.00
 Count relative letter frequencies Z 11.67 D 5.00 W 3.33 G 1.67 K 0.00
 Guess {P, Z} = {e, t} S 8.33 E 5.00 Q 2.50 Y 1.67 L 0.00
 Of double letters, ZW has highest frequency, so U 8.33 V 4.17 T 2.50 I 0.83 N 0.00
guess ZW = th and hence ZWP = the
 Proceeding with trial and error finally get: O 7.50 X 4.17 A 1.67 J 0.83 R 0.00
it was disclosed yesterday that several informal but M 6.67
direct contacts have been made with political
representatives of the viet cong in moscow Assignment:
Count double/triple letter
frequency of CT
HOMOPHONIC CIPHER
 Replacing each letter with a variety of
substitutes (homophones) where a
homophone is used in rotation or chosen
randomly.
 The number of potential substitutes are
proportional to the frequency of the letter.
 pt: defending against frequency analysis attacks
 CT: 45 14 31 87 66 01 73 59 25 09 06 78 88
71 11 49 10 40 98 94 63 46 58 41 52 12 58 53
26 21 19 73 36 33 20 69 67 62 04 76
HOMOPHONIC CIPHER-CRYPTANALYSIS

 Usually, the highest-frequency plaintext symbols are given more equivalents than lower frequency letters. In this
way, the frequency distribution is flattened, making analysis more difficult.
 Mongram frequencies are balanced off but digram, trigram frequencies still persist.
 Example: Book Cipher, Beale cipher, Straddling checkerboard
PLAY FAIR CIPHER

 In a polygraphic substitution cipher, plaintext letters are substituted in larger groups, instead of substituting letters
individually.
 Encrypt multiple letters at a time.
 The first advantage is that the frequency distribution is much flatter than that of individual letters
 Second, the larger number of symbols requires correspondingly more ciphertext to productively analyze letter
frequencies.
 The Playfair Cipher is the best known such cipher. Widely used from 1860 to 1960.
PLAY FAIR CIPHER

 Use a 5 x 5 matrix.
 Fill in letters of the key (w/o duplicates).
 Fill the rest of matrix with other letters.
 E.g., key = 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
PLAY FAIR CIPHER-EXAMPLE
 Key: playfair example

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 the letter to its right
(circularly).
3. If both letters fall in the same column,
replace each with the the letter below it
(circularly).
4. Otherwise, each letter is replaced by the
letter in the same row but in the column
of the other letter of the pair.
PLAY FAIR CIPHER-EXAMPLE

Message: Hide the gold in the tree stump


Plaintext is encrypted two letters at a time. Digraph: HI DE TH EG OL DI NT HE TR EX ES TU
1. If a pair is a repeated letter, insert filler MP
like 'X’.
2. If both letters fall in the same row,
replace each with the letter to its right
(circularly).
3. If both letters fall in the same column,
replace each with the the letter below it
(circularly).
4. Otherwise, each letter is replaced by the
letter in the same row but in the column
of the other letter of the pair.
PLAY FAIR CIPHER-EXAMPLE

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 the letter to its right
(circularly).
3. If both letters fall in the same column,
replace each with the the letter below it
(circularly).
4. Otherwise, each letter is replaced by the
letter in the same row but in the column
of the other letter of the pair.

Message: Hide the gold in the tree stump  Encrypted Message:


Digraph: HI DE TH EG OL DI NT HE TR EX ES TU BMODZBXDNABEKUDMUIXMMOUVIF
MP
PLAY FAIR CIPHER-CRYPTANALYSIS
PLAY FAIR CIPHER-EXAMPLE

 Key: Black Cat


 Plain Text: Attack at dawn while they are sleeping

 Cipher Text: ?
POLY ALPHABETIC CIPHERS

 A plaintext letter maps to multiple ciphertext letters.


 Multiple mono-alphabetic substitutions are applied through the plaintext.
 A key defines which mono-alphabetic substitution to apply.
1. Vigenere cipher
2. Verman cipher
3. One-Time Pad
VIGENERE CIPHER
 Constitutes of 26 Caesar ciphers To encrypt n plaintext letters:
 Ci = (pi + ki) mod 26; 1≤i≤n
 To decrypt n ciphertext letters:
 pi = (Ci - ki) mod 26; 1≤i≤n
 The key is of length d i.e. K = k1 k2 ... kd
 Use each key letter in turn.
 Repeat from k1 after d letters.
 K : deceptive
 PT: we are discovered save yourself

d e c e p t i v e d e c e p t i v e d e c e p t i v e

we a r e d i s c o v e r e d s a v e y o u r s e l f

Z I C V T WQ N G R Z G V T WA V Z H C Q Y G L M G J
VIGENERE CIPHER-CRYPTANALYSIS

K:
d e c e p t i v e d e c e p t i v e d e c e p T i v e

PT: w e a r e d i s c o v e r e d s a v e y o u r s e l f

Z I C V T WQ N G R Z G V T WA V Z H C Q Y G L M G J
CT:
1 2 3 4 5 6 7 8 9 10 11 12

 Two identical sequences of plaintext occurring at a distance that is integer multiple of keyword length, generate
identical ciphertext sequences.
 Here, keyword length could be:
 3 or 9
VIGENERE CIPHER-CRYPTANALYSIS

 Lets say, we have somehow determined the keyword length as 9.


 This suggests using 9 monoalphabetic ciphers.
 PT at index 1, 10, 19, 28…. are encrypted with one key.
 PT at index 2, 11, 20, 29…. are encrypted with same key.
 And so on…
 Individual frequency analysis can be carried out on the 9 ciphers.
AUTOKEY OR AUTOCLAVE CIPHER

 This is an extension of vigenere cipher.


 Plaintext: THIS IS A SECRET TEXT
Keyword: KEY
Key: KEYTHISISASECRETT
Encoded text: DLGLPASAWCJIVKIQM
 It can be used as a stream cipher
 Statistical analysis is still possible for letter encrypted by themselves as keys
VERMAN CIPHER

 The one-time pad, which is a provably secure


cryptosystem, was developed by Gilbert Vernam in 1918.  message: 0 0 1 0 1 1 0 1 0 1 1 1
 The message is represented as a binary string (a sequence  pad: 100111001011
of 0’s and 1’s using a coding mechanism such as ASCII
coding.  cipher: 1 0 1 1 0 0 0 1 1 1 0 0 (XOR)
 The key is a truly random sequence of 0’s and 1’s of the RECEIVING
same length as the message.
 cipher: 101100011100
 The encryption is done by adding the key to the message
modulo 2, bit by bit. This process is often called exclusive  pad: 1 0 0 1 1 1 0 0 1 0 1 1 (XOR)
or, and is denoted by XOR.
 message: 0 0 1 0 1 1 0 1 0 1 1 1
 The symbol ⊕ is used.
ONE TIME PAD(OTP)

 To encrypt n plaintext bits:


Ci = (pi  ki) 1≤i≤n
 To decrypt n ciphertext bits:
pi = (Ci  ki) 1≤i≤n
 There is no statistical relationship between the CT and PT now.
 Issues with OTP
1. Generating large quantities of random keys is a challenge
2. Secure key distribution and storage is even bigger challenge
RAIL FENCE

 Plain text is written down in the sequence of diagonals and then read off as a sequence of rows
 E.g. the PT: meet me after the party, is written using a rail fence of depth 2 as:
m e m a t r h t g p r y
e t e f e t e o a a t
 CT: MEMATRHTGPRYETEFETEOAAT
 Examle:
Plain Text: WE ARE DISCOVERED. FLEE AT ONCE
COLUMNAR TRANSPOSITION CIPHER

 Write the message row-wise.


 Read the message column-wise, in some
specific order. 4 3 1 2 5 6 7
 For example: a t t a c k p
Plaintext: Attack Postponed until two am o s t p o n e
Ciphertext: d u n t i l t
TTNAAPTMTSUOAODWCOIXKNLYPETZ w o a m x y z
Key: 4312567 or DCABEFG
Column length is specified by first number in
key.
COLUMNAR TRANSPOSITION CIPHER-CRYPTANALYSIS

 Simple transposition can be easily detected by doing a frequency count.


 Can be attacked by anagramming (rearranging).
 Also keys very close to the correct key will reveal long sections of legible plaintext interspersed by gibberish.
 Can be more secure if multiple stages of transposition, using multiple keys, are performed.
 Double columnar transposition is more secure and is similar to single columnar transposition, but
the process is repeated twice.
ROTOR MACHINES
STEGANOGRAPHY

 Technique to conceal the existence of the message


 Example: Simply encrypt correct reading exactly twice.
PT: Secret
 Types
1. Character marking
2. Invisible ink
3. Pin puncture
4. Type writer color ribbon
 Drawbacks:
1. Lots of overhead
2. Discovered system becomes worthless
 Advantages:
1. Effective when CT is concealed using stenography
2. Does not raise alarm regarding secrecy
QUESTIONS

You might also like