Professional Documents
Culture Documents
Lec 03 Basic
Lec 03 Basic
Lectures 2 & 3
Basic Encryption &
Decryption
Shambhu Upadhyaya
Computer Science &
Eng.
University at Buffalo
Buffalo, New York,
14260
CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.1
Overvie
Lecture 3 w
Terminology (5 minutes)
Encryption by Substitutions &
Transpositions (70 minutes)
Lecture 4
Any leftover material from Lecture 3
Examples
Tracking a hacker (55 minutes video
presentation)
CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.2
Terminolog
Encryption y
A process of encoding a message
Decryption
Original
It is the reverse process
Plaintext Plaintext
Ciphertext
Encryption Decryption
P=(p1,p2, …pn) P=D(C)
C=(c1,c2, … cm) =D(E(P))
C=E(P)
Encryption Algorithms
A key K is generally used
P D ( K , E ( K , P ))
Symmetric encryption:
P D( KD, E ( KE , P ))
Asymmetric encryption: CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.3
Cryptography &
Cryptography
Cryptanalysis
Hidden writing -- encryption to conceal
text
Cryptanalysis
Break an encryption
Attempt to break a single message
Attempt to recognize patterns in encrypted
messages
Attempt to find general weaknesses
Breakable Encryption
Given enough time and data, encryption
can be broken
Practicality is an issue
Risky to pronounce an algorithm secure!
CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.4
Substitutions &
Transpositions
Substitutions
Monoalphabetic Ciphers
Polyalphabetic Ciphers
These are called Stream Ciphers
Transpositions
Permutation
These are Block Ciphers
CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.5
Monoalphabetic
Caesar Cipher
Ciphers
Formula: ci E ( pi ) pi 3
Treaty Impossible --> wuhdwb lpsrvvleoh
Advantages & Disadvantages
Easy to perform
Simple, so easy to predict the pattern
Repeat characters give clue to break
Permutation Cipher
Use a key
ABCDE ………
k e ya b……….
Since key is short, most plaintext letters are only
one or two positions off
Time complexity of these algorithms -- linear in n
where n is the no. of characters in plaintext
CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.6
Polyalphabetic
Substitution
Main problem withCiphers
monoalphabetic ciphers is
the non-flat frequency distribution
A flat distribution gives no information to
cryptanalyst
Flattening by combining distributions
Two or more separate encryption alphabets for
the same character of the plaintext
Eg., one encryption for characters in odd
positions and another for at even positions
Reduces the repeat symbols in the ciphertext
Makes it hard to break
(Discuss an example from the Book) CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.7
Vigenere
Need to Tableaux
smooth out peaks and valleys of
frequency distribution
Can be done by extending no. of permutations
Extreme case -- extend to 26 permutations
A 26 X 26 table is used (example from Book)
Key word of length 3 is sufficient to smooth
out the distribution
Cryptanalysis of Polyalphabetic Substitution
Reading exercise
Focus on Kasiski method and Index of
Coincidence method
CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.8
Perfect Substitution
Cipher
Requires an infinite non-repeating sequence of
alphabets
This will confound the cryptanalyst
Vernam Cipher
Uses an arbitrarily long sequence of numbers
Formula: ci ri pi mod n
Random Numbers
Middle digits of phone numbers in a residential
directory
Pseudo random numbers -- linear congruential
random number generator
Formula: ri 1 ( a * ri b) mod n CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.9
Transposition
sthe message are rearranged
It is a method where letters of
Goal here is diffusion rather than confusion
Information is spread widely across the ciphertext
Columnar transposition is an easy one
Characters are rearranged into columns
Study an example from Book
Encipherment/Decipherment Complexity
Algorithm is constant in the amount of work per character
Time is proportional to length of message
Space required is directly proportional to message length
Output characters cannot be produced until all characters
are read in
Delay depends on the length of the message
Not appropriate for long messages CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.10
Cryptanalysi
s
Digrams, trigrams & other patterns used to break
encryption
Digram -- letter pairs such as -re- -th- -en- -ed-
etc.
Trigram -- groups such as ent, and, ing, thi etc.
Cryptanalysis by trial & error & using a moving
window for comparison
This is a reading exercise! (Sec. 2.4)
Double transposition algorithm makes breaking
more difficult
It uses transposition of a transposed text
See example from the Book CSE565: S.
9/03/02 UB Fall 2002 Upadhyaya
Lec 3.11
Summar
Stream Ciphers y
Mono and poly-alphabetic encryptions
Since they convert one symbol of plaintext
immediately into a symbol of ciphertext
Features include: a) speed of transformation, b) low
error propagation
Disadvantages are: a) low diffusion, b) susceptible
to malicious insertions
Block Ciphers
Columnar transposition algorithm and fractionated
Morse
Since a group of plaintext symbols are encrypted as
one block
Features include: a) diffusion, b) immunity to
insertions
Disadvantages are: a) slowness of encryption, b)
CSE565: S.
9/03/02
error propagation UB Fall 2002 Upadhyaya
Lec 3.12