Classical Cryptography

21
Classical Cryptography

description

Classical Cryptography. What is cryptography?. kryptos – “hidden” grafo – “write” Keeping messages secret Usually by making the message unintelligible to anyone that intercepts it. The Problem. Private Message. Bob. Alice. Eavesdropping. Eve. The Solution. Private Message. - PowerPoint PPT Presentation

Transcript of Classical Cryptography

Page 1: Classical Cryptography

Classical Cryptography

Page 2: Classical Cryptography

What is cryptography?

kryptos – “hidden” grafo – “write”

Keeping messages secretUsually by making the message unintelligible

to anyone that intercepts it

Page 3: Classical Cryptography

The Problem

Bob Alice

Eve

Private Message

Eavesdropping

Page 4: Classical Cryptography

The Solution

Bob Alice

Eve

Scrambled Message

Eavesdropping

Encryption Decryption

Private Message Private Message

Page 5: Classical Cryptography

What do we need?

Bob and Alice want to be able to encrypt/decrypt easily

But no one else should be able to decrypt How do we do this?

Keys!

Page 6: Classical Cryptography

Using Keys

Plaintext

Ciphertext DecryptionEncryption

Plaintext

Nonsense

Page 7: Classical Cryptography

What is a cipher?

A cipher is an algorithm for encryption/decryption

Kerckhoff’s Principle: All details of the cipher should be publicEve still shouldn’t be able to decrypt

messages unless she has the secret key

Page 8: Classical Cryptography

The Shift Cipher

We “shift” each letter over by a certain amount

ILYH UHG EDOORRQV

five red balloons

f + 3 = Ii + 3 = Lv + 3 = Y

Plaintext

Ciphertext

EncryptionKey = 3

Page 9: Classical Cryptography

The Shift Cipher cont.

To decrypt, we just subtract the key

five red balloons

I - 3 = fL - 3 = iY - 3 = v

Plaintext

DecryptionKey = 3

ILYH UHG EDOORRQV Ciphertext

Page 10: Classical Cryptography

What’s wrong with the shift cipher?

Not enough keys! If we shift a letter 26 times, we get the

same letter backA shift of 27 is the same as a shift of 1, etc.So we only have 25 keys (1 to 25)

Eve just tries every key until she finds the right one

Page 11: Classical Cryptography

The Substitution Cipher

Rather than having a fixed shift, change every plaintext letter to an arbitrary ciphertext letter

a G

b X

c N

d S

e D

… …

z Q

Plaintext Ciphertext

Page 12: Classical Cryptography

The Substitution Cipher cont.

a G

b X

c N

d S

e D

f A

g F

h V

i L

j M

k C

l O

m E ALRD HDS XGOOYYBW

five red balloons

f = Ai = Lv = R

Plaintext

Ciphertext

Encryption

Key =

n B

o Y

p Z

q P

r H

s W

t I

u J

v R

w U

x K

y T

z Q

Page 13: Classical Cryptography

The Substitution Cipher cont.

To decrypt we just look up the ciphertext letter in the table and then write down the matching plaintext letter

How many keys do we have now? A key is just a permutation of the letters of the

alphabet There are 26! permutations

403291461126605635584000000

Page 14: Classical Cryptography

Breaking the Substitution Cipher

If we could do 1 000 000 calculations per second, it would take over 12.7x1012 years to try all possible keysThe universe is about 13.7x109 years old

Trying all possible keys is probably not going to work

Page 15: Classical Cryptography

Frequency Analysis

In English (or any language) certain letters are used more often than others

If we look at a ciphertext, certain ciphertext letters are going to appear more often than others

It would be a good guess that the letters that occur most often in the ciphertext are actually the most common English letters

Page 16: Classical Cryptography

Letter Frequency

This is the letter frequency for English

The most common letter is ‘e’ by a large margin, followed by ‘t’, ‘a’, and ‘o’

‘J’, ‘q’, ‘x’, and ‘z’ hardly occur at all

Page 17: Classical Cryptography

Frequency Analysis in Practice

Suppose this is our ciphertext dq lqwurgxfwlrq wr frpsxwlqj surylglqj d eurdg vxuyhb

ri wkh glvflsolqh dqg dq lqwurgxfwlrq wr surjudpplqj. vxuyhb wrslfv zloo eh fkrvhq iurp: ruljlqv ri frpsxwhuv, gdwd uhsuhvhqwdwlrq dqg vwrudjh, errohdq dojheud, gljlwdo orjlf jdwhv, frpsxwhu dufklwhfwxuh, dvvhpeohuv dqg frpslohuv, rshudwlqj vbvwhpv, qhwzrunv dqg wkh lqwhuqhw, wkhrulhv ri frpsxwdwlrq, dqg duwlilfldo lqwhooljhqfh.

Page 18: Classical Cryptography

0

0.02

0.04

0.06

0.08

0.1

0.12

a b c d e f g h i j k l m n o p q r s t u v w x y z

Letter

Rel

ativ

e F

req

uen

cy

Ciphertext distribution English distribution

In our ciphertext we have one letter that occurs more often than any other (h), and 6 that occur a good deal more than any others (d, l, q, r, u, and w)

There is a good chance that h corresponds to e, and d, l, q, r, u, and w correspond to the 6 next most common English letters

Page 19: Classical Cryptography

Frequency Analysis cont.

If we replace ‘e’ with ‘h’ and the 6 next most common letters with their matches, the ciphertext becomes an intro???tion to ?o?p?tin? pro?i?in? a ?roa? ??r?e? o?

t?e ?i??ip?ine an? an intro???tion to pro?ra??in?. ??r?e? topi?? ?i?? ?e ??o?en ?ro?: ori?in? o? ?o?p?ter?, ?ata repre?entation an? ?tora?e, ?oo?ean a??e?ra, ?i?ita? ?o?i? ?ate?, ?o?p?ter ar??ite?t?re, a??e???er? an? ?o?pi?er?, operatin? ???te??, net?or?? an? t?e internet, t?eorie? o? ?o?p?tation, an? arti?i?ia? inte??i?en?e.

Page 20: Classical Cryptography

Modern Cryptography

Frequency analysis was the best cryptanalysis until the invention of computers

Next timeModern ciphersCryptography wins WWIIFighting the man

Page 21: Classical Cryptography

The End