Professional Documents
Culture Documents
Lecture 02
Lecture 02
Lecture Outline
Outline
• What is ahead?
Encryption
Encryption
• Basic terminology
– plaintext or message
– ciphertext
– cryptographic key
– message space M
– ciphertext space C
– key space K
• We obtain:
– Gen : N → K
– Enc : M × K → C
– Dec : C × K → M
Encryption
Encryption
– correctness
– security
Types
Types of
of Encryption
Encryption
• Public-key encryption
• Example
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
– Message M = CIPHER
– Ciphertext C = ?
R
• Gen: choose k ← K
• Example
• The fact: each language has certain features such as frequency of letters and
frequency of groups of letters
• Example:
YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ
NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ
NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ
XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR
Another
Another Attack
Attack on
on Shift
Shift Ciphers
Ciphers
R
• Gen: choose l ← N and random key k l
Z 26
←
• Enc: given key k = ( k 1 , k 2 , . . ., k l ) , encrypt l-character message m as
Enc k (m 1 , . . ., m l ) = ( ( m 1 + k 1 ) m o d 26, . . ., ( m l + k l ) m o d 2 6 )
• To decrypt c using k:
Dec k (c 1 , . . ., c l ) = ( ( c 1 − k 1 ) m o d 26, . . ., ( c l − k l ) m o d 2 6 )
Vigenere
Vigene Cipher
`re `Cipher
• Example:
• Shift ciphers are vulnerable to frequency analysis attacks, but what about
the Vigene`re cipher?
• Then we can divide the message into l parts and use frequency analysis
on each
Vigenere
Vigene Cipher: Cryptanalysis
`re` Cipher: Cryptanalysis
• There are two methods to find the key length: Kasisky test and index
of coincidence
• Kasisky test:
• Index of coincidence:
• Index of coincidence:
• Thus we can test for various key lengths to see whether I c of the
ciphertext is close to that of English
– if the values are not close to 0.065, try a different key length l
Σ
25 fi Σ
25 Σ
25 2
2 f i( f i − 1) fi Σ25
i= 0 i= 0 2
I c( x ) = n = i=0 ≈ = qi
n( n − 1) n2 i= 0
2
Cipher
Cipher Cryptanalysis
Cryptanalysis
• Shift ciphers have small key space and are easy to break using brute
force search