Lecture 2-Advance Cryptography-1
Lecture 2-Advance Cryptography-1
LECTURE # 2
DR. MADIHA KHALID
OVERVIEW LECTURE 1
OVERVIEW OF THE COURSE
Plain text
Encryption algorithm
Secret key
Cipher text
Decryption algorithm
SYMMETRIC CIPHER MODEL
http://www.mathstat.dal.ca/~dilcher/4116/Portraits/speedbump21044350010716.gif
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
Block Stream
Substitution Transposition Symmetric Asymmetric
ciphers ciphers
CRYPTANALYSIS
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
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
Mono-alphabetic Columnar
Transposition
Playfair
Poly-alphabetic
CEASAR CIPHER
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
Cipher Text: ?
POLY ALPHABETIC CIPHERS
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
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