14
Introduction to Cryptography Lecture 8

Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Embed Size (px)

Citation preview

Page 1: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Introduction to Cryptography

Lecture 8

Page 2: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Polyalphabetic Substitutions

Definition: Let be different substitution ciphers. Then to encrypt the message apply .

If the length of the message is longer than number of different ciphers, then repeat same ciphers in the same order.

nEEE ,...,, 21

nppp ,...,, 21 )( ii pE

Page 3: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Polyalphabetic Substitutions

Example: Let the message be: Today is Tuesday. Let , where is a shift cipher with k=i.

The message: UQGEZKUXVGVHBA. Two same letters encrypted to different

letters Can not use English properties directly

4321 ,,, EEEE iE

Page 4: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Vigenere Square

Page 5: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Vigenere Square

Example: Let the message be: APRIL SHOWERS BRING MAY FLOWERS. Let the key word be: RHYME.

Using the square we encrypt plaintext and get the message: RWPUPJOMIIIZZDMENKMCWSMIIIZ.

Page 6: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Vigenere Cipher

Suppose the key word has n letters. Let the key letters be Let the plaintext be Let the cipher text be

Then

nkkk ,...,, 21

mxxx ,...,, 21

myyy ,...,, 21

26mod)( modniii kxy

Page 7: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Index of Coincidence

Definition: The index of coincidence, I, is the probability that two randomly selected letters in ciphertext are identical.

Formula:

If I is close to 0.065, then most probably the cipher is monoalphabetic

If I is close to 0.0385, then most probably the cipher is polyalphabetic

)1(

)1(25

0

nn

nnI

iii

Page 8: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Index of Coincidence

Example: Let the message be: WSPGMHHEHMCMTGPNROVXWISCQTXHKRVESQTIMMKWBMTKWCSTVLTGOPZXGTQMCXHCXHSMGXWMNIAXPLVYGROWXLILNFJXTJIRIRVEXRTAXWETUSBITJMCKMCOTWSGRHIRGKPVDNIHWOHLDAIVXJVNUSJX.

Page 9: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Index of Coincidence

Example: Build a table of letter frequencies (there are 152 letters):A B C D E F G H I J K L M3 2 7 2 4 1 8 9 10 5 5 5 11N O P Q R S T U V W X Y Z5 5 5 3 8 8 12 2 8 9 13 1 1

104801011213...671223)1(25

0

iii

nn

0457.0)1152(152

1048

)1(

)1(25

0

nn

nnI

iii

Page 10: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Vigenere Cipher

Vigenere cipher uses a keyword Let length of the keyword be k Assume the ciphertext is given We know message encrypted using

Vigenere Cipher We can find estimated key size using:

)0385.0()065.0(

0265.0

InI

nk

Page 11: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Vegenere Cipher

Example: For last example with n=152.

The keyword may be about 4 letters.

617.31137.1

028.4

)0385.00457.0(152)0457.0065.0(

1520265.0

k

Page 12: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

The Kasiski Test The Kasiski test relies on the occasional

coincidental alignment of letter groups in plaintext with the keyword

Find groups of same letters of size 3 or more Calculate distance between those groups The greatest common divisor of those

distances have a good chance to be the length of the key

Page 13: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

The Kasiski Test Example: Let the message be:

WCZOUQNAHYYEDBLWOSHMAUCERCELVELXSSUZLQWBSVYXARRMJFIAWFNAHBZOUQNAHULKHGYLWQISTBHWLJCYVEIYWVYJPFNTQQYYIRNPHSHZORWBSVYXARRMJFIAWF.

For NAH distances: 48 and 8For WBSVYXARRMJFIAWF: 72The keyword can be of size: 2,4 or 8.

Page 14: Introduction to Cryptography Lecture 8. Polyalphabetic Substitutions Definition: Let be different substitution ciphers. Then to encrypt the message apply

Homework

Read pg.107-117. Exercises: 1(a), 3(c) on pg.118. Read pg.134-141. Exercises: 3, 8 on pg.141-143. Those questions will be a part of your

collected homework.