48
Classical Cryptography Classical Cryptography I I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Embed Size (px)

Citation preview

Page 1: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Classical Cryptography IClassical Cryptography I

CS432 - Security in Computing

Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Page 2: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Section OverviewSection Overview

Cryptography TypesCryptography Types

Shifts and Keyword Substitution CiphersShifts and Keyword Substitution Ciphers

Polyalphabetic Substitution CiphersPolyalphabetic Substitution Ciphers

Perfect Ciphers and Random Number Perfect Ciphers and Random Number

GenerationGeneration

Page 3: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

ReferencesReferences

Security in Computing, 3Security in Computing, 3rdrd Ed. Ed. Chapter 2 (pgs. 35-66)Chapter 2 (pgs. 35-66)

Online ResourcesOnline Resources The Codebook CD, Simon Singh, Simon Singh

Page 4: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Message ComponentsMessage Components

Source: Gilbert HeldUnderstanding Data Communications, 1st Ed.

Page 5: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Possible Intruder GoalsPossible Intruder Goals

Intercept itIntercept it Modify itModify it Fabricate an authentic looking Fabricate an authentic looking

messagemessage Block it (deny access to)Block it (deny access to)

Page 6: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Classical CryptographyClassical Cryptography

Alphabetic SubstitutionsAlphabetic Substitutions ShiftsShifts Mono-Alphabetic ReplacementsMono-Alphabetic Replacements Poly-Alphabetic ReplacementsPoly-Alphabetic Replacements One-Time PadsOne-Time Pads

TranspositionsTranspositions Most were stream ciphers Most were stream ciphers

Page 7: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Basic Encryption ProcessBasic Encryption Process

------------------------------------------------------------------------------------

EncryptionEncryption DecryptionDecryption

PlaintextPlaintext PlaintextPlaintextCiphertextCiphertext

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

------------------------------------------------------------------------------------

Page 8: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Symmetric Key EncryptionSymmetric Key Encryption

------------------------------------------------------------------------------------

EncryptionEncryption

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

------------------------------------------------------------------------------------

DecryptionDecryption

Shared Shared KeyKey

PlaintextPlaintext PlaintextPlaintextCiphertextCiphertext

Page 9: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Asymmetric Key EncryptionAsymmetric Key Encryption

------------------------------------------------------------------------------------

EncryptionEncryption

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

------------------------------------------------------------------------------------

DecryptionDecryption

Recipient’sRecipient’sPublic KeyPublic Key

Recipient’sRecipient’sPrivate KeyPrivate Key

PlaintextPlaintext PlaintextPlaintextCiphertextCiphertext

Page 10: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

CRYPTANALYSIS TOOLSCRYPTANALYSIS TOOLS

Math and statistical Math and statistical techniquestechniques

Properties of Properties of languageslanguages

ComputersComputers

Ingenuity and luckIngenuity and luck

Encrypted messagesEncrypted messages

Known encryption Known encryption algorithmsalgorithms

Intercepted plaintextIntercepted plaintext

Cribs - Data known Cribs - Data known or suspected to beor suspected to bein enciphered in enciphered messagesmessages

Source: Lance HoffmanGeorge Washington University

Page 11: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

The Alphabet & Modular The Alphabet & Modular ArithmeticArithmetic

A B C D E F G H I J K L MA B C D E F G H I J K L M0 1 2 3 4 5 6 7 8 9 10 11 120 1 2 3 4 5 6 7 8 9 10 11 12

N O P Q R S T U V W X Y ZN O P Q R S T U V W X Y Z13 14 15 16 17 18 19 20 21 22 23 24 2513 14 15 16 17 18 19 20 21 22 23 24 25

Arithmetic operation Arithmetic operation mod 26 = [0,25]mod 26 = [0,25]

Page 12: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

SubstitutionSubstitution

Substitution CiphersSubstitution Ciphers

MonoalphabeticMonoalphabetic

OtherOther

KeywordKeywordShiftShift

PolyalphabeticPolyalphabetic

Source: Richard SpillmanPacific Lutheran University

Page 13: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Caesar Cipher - Simple Shift Caesar Cipher - Simple Shift

This is a cipher algorithm that transforms This is a cipher algorithm that transforms each Plaintext character into a Ciphertext each Plaintext character into a Ciphertext character shifted a fixed distance down character shifted a fixed distance down the alphabet the alphabet The key is the distance of the shiftThe key is the distance of the shift For example, a key of 3 would replace each For example, a key of 3 would replace each

Plaintext “a” with “d”, each “b” with “e”, etc.Plaintext “a” with “d”, each “b” with “e”, etc. Easy for children to use as a secret code, Easy for children to use as a secret code,

but obvious pattern is its major weaknessbut obvious pattern is its major weakness

Page 14: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Caesar Cipher ExampleCaesar Cipher Example

If the key is 5 then the Plaintext If the key is 5 then the Plaintext alphabet becomes the Ciphertext alphabet becomes the Ciphertext alphabet shown below:alphabet shown below:

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 za b c d e f g h i j k l m n o p q r s t u v w x y zf g h i j k l m n o p q r s t u v w x y z a b c d ef g h i j k l m n o p q r s t u v w x y z a b c d e

t h i st h i s

yy mm nn xx

Source: Richard SpillmanPacific Lutheran University

Page 15: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

DECRYPTING CAESAR CIPHERSDECRYPTING CAESAR CIPHERS

Break between words. Blank translatedBreak between words. Blank translatedto self reveals small wordsto self reveals small words

Double letter. No QQ pairs in English!Double letter. No QQ pairs in English!

Repeated letters translating to same thingRepeated letters translating to same thing

wuhdwb lpsrvvleohwuhdwb lpsrvvleoh

Source: Lance J. Source: Lance J. HoffmanHoffman

Page 16: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

0

2

4

6

8

10

12

14

16

18

a c e g i k m o q s u w y

Pe

rce

nt

CipherEnglish

Frequency DistributionFrequency Distribution

Source: Hoffman & PfleegerSource: Hoffman & Pfleeger

Page 17: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Keyword SubstitutionsKeyword Substitutions

Choose a “key word” such as Choose a “key word” such as countcount Write out the alphabet; then write Write out the alphabet; then write

the keyword directly below the first the keyword directly below the first few letters of the alphabetfew letters of the alphabet

Complete the second row by writing Complete the second row by writing (in order) the unused letters(in order) the unused letters

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 za 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

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

Letter:

Code:

Page 18: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Starting PositionStarting Position

The keyword does not have to start The keyword does not have to start at the beginning of the plaintext at the beginning of the plaintext alphabetalphabet it could start at any letterit could start at any letter for example, “count” could start at “k”for example, “count” could start at “k”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 za b c d e f g h i j k l m n o p q r s t u v w x y zm p q r s v w x y z c o u n t a b d e f g h i j k lm p q r s v w x y z c o u n t a b d e f g h i j k l

Note: the alphabet wraps aroundNote: the alphabet wraps around

Source: SpillmanSource: Spillman

Page 19: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Key Word ExampleKey Word Example

If the keyword is “visit” (note, the If the keyword is “visit” (note, the second “i” is visit is dropped below) second “i” is visit is dropped below) starting at “a” and the plaintext is starting at “a” and the plaintext is “next”, the application is:“next”, the application is:

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 za b c d e f g h i j k l m n o p q r s t u v w x y zv i s t a b c d e f g h j k l m n o p q r u w x y zv i s t a b c d e f g h j k l m n o p q r u w x y z

n e x tn e x t

kk aa xx qqSource: Spillman

Page 20: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Frequency TableFrequency Table

a 3312 7.49 n 2982 6.74b 573 1.29 o 3261 7.37c 1568 3.54 p 1074 2.43d 1602 3.62 q 116 0.26e 6192 14 r 2716 6.14f 966 2.18 s 3072 6.95g 769 1.74 t 4358 9.85h 1869 4.22 u 1329 3i 2943 6.65 v 512 1.16j 119 0.27 w 748 1.69k 206 0.47 x 123 0.28l 1579 3.57 y 727 1.64

m 1500 3.39 z 16 0.04

Letter Frequency Pct. Letter Frequency Pct.

n = 44232

Page 21: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Frequency GroupingsFrequency Groupings

HighHighEE

TT

A O N I R SA O N I R S

HH

MediumMedium D L U C MD L U C M

LowLow P F Y W G B VP F Y W G B V

RareRare J K Q X ZJ K Q X Z

There is usually a 2% drop between the high and mediumThere is usually a 2% drop between the high and mediumFrequency letter groupsFrequency letter groups

Source: Richard SpillmanSource: Richard Spillman

Page 22: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

English CharacteristicsEnglish Characteristics

Three vowels: “a”, “I”, “o” tend to avoid Three vowels: “a”, “I”, “o” tend to avoid each other each other

Vowels make up 40% of messagesVowels make up 40% of messages High-frequency letters make up 70% of High-frequency letters make up 70% of

messagemessage 80% of letters before “n” are vowels80% of letters before “n” are vowels ““h” frequently proceeds “e” but rarely h” frequently proceeds “e” but rarely

followsfollows

Source: Richard SpillmanSource: Richard Spillman

Page 23: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Digrams and TrigramsDigrams and Trigrams

Top 10 DigramsTop 10 Digrams

THTH ININHEHE ERERRERE ONONESES ANANATAT TITI

Top 10 TrigramsTop 10 Trigrams

THETHE INGINGTHATHA ANDANDHATHAT IONIONENTENT YOUYOUTHITHI FORFOR

These are just as prevalent as individual charactersThese are just as prevalent as individual charactersand can be subjected to the same kind of relativeand can be subjected to the same kind of relativefrequency analysis ~ some like qp just don’t exist.frequency analysis ~ some like qp just don’t exist.

Source: Source: Making, Breaking CodesMaking, Breaking CodesBy Paul GarrettBy Paul Garrett

Page 24: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Polyalphabetic SubstitutionsPolyalphabetic Substitutions Monoalphabetic ciphers produce the same Monoalphabetic ciphers produce the same

distributions as plaintext. To flatten the ciphertext distributions as plaintext. To flatten the ciphertext distribution, try combining two ciphers so that letters distribution, try combining two ciphers so that letters of high and low frequency will map to the same cipher of high and low frequency will map to the same cipher letter.letter. ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZADGJMPSVYBEHKNQTWZCFILORUXADGJMPSVYBEHKNQTWZCFILORUX

3a mod 26 above for odd positions3a mod 26 above for odd positions

ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZNSXCHMRWBQLQVAFKPUZEJOTYDINSXCHMRWBQLQVAFKPUZEJOTYDI

(5a + 13) mod 26 above for even positions(5a + 13) mod 26 above for even positions

TREAT YIMPO SSIBL ETREAT YIMPO SSIBL E encrypts to encrypts toFUMNF DYVTF CZYSH HFUMNF DYVTF CZYSH H

Page 25: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Vigenère CipherVigenère Cipher

This is an example of a This is an example of a polyalphabetic cipher where the polyalphabetic cipher where the substitution pattern variessubstitution pattern varies that is, a plaintext “e” may be replaced that is, a plaintext “e” may be replaced

by a ciphertext “p” one time and a by a ciphertext “p” one time and a ciphertext “w” anotherciphertext “w” another

the Vigenère cipher does this using a the Vigenère cipher does this using a Vigenère tableVigenère table

Page 26: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Vigenère TableVigenère Table

The table The table lists the keylists the keycharacters characters onontop and thetop and theplaintextplaintextcharacters characters ononthe sidethe side

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 za 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 zb 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 an c d e f g h i j k l m n o p q r s t u v w x y z a bd d e f g h i j k l m n o p q r s t u v w x y z a b ce e f g h i j k l m n o p q r s t u v w x y z a b c df f g h i j k l m n o p q r s t u v w x y z a b c d e g g h i j k l m n o p q r s t u v w x y z a b c d e f h h i j k l m n o p q r s t u v w x y z a b c d e f g i i j k l m n o p q r s t u v w x y z a b c d e f g h j j k l m n o p q r s t u v w x y z a b c d e f g h i k k l m n o p q r s t u v w x y z a b c d e f g h i j l l m n o p q r s t u v w x y z a b c d e f g h i j k m m n o p q r s t u v w x y z a b c d e f g h i j k l n n o p q r s t u v w x y z a b c d e f g h i j k l m o o p q r s t u v w x y z a b c d e f g h i j k l m n p p q r s t u v w x y z a b c d e f g h i j k l m n o q q r s t u v w x y z a b c d e f g h i j k l m n o p r r s t u v w x y z a b c d e f g h i j k l m n o p q s s t u v w x y z a b c d e f g h i j k l m n o p q r t t u v w x y z a b c d e f g h i j k l m n o p q r s u u v w x y z a b c d e f g h i j k l m n o p q r s t v v w x y z a b c d e f g h i j k l m n o p q r s t u w w x y z a b c d e f g h i j k l m n o p q r s t u v a x y z a b c d e f g h i j k l m n o p q r s t u v w y y z a b c d e f g h i j k l m n o p q r s t u v w x z z 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

Page 27: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

A keyword is selected and it is A keyword is selected and it is repeatedly written above the plaintextrepeatedly written above the plaintext EXAMPLE: using the keyword “hold”EXAMPLE: using the keyword “hold”

Each column forms a keyword/plaintext Each column forms a keyword/plaintext letter pair which is used in the Vigenère letter pair which is used in the Vigenère table to determine the ciphertext lettertable to determine the ciphertext letter

Vigenère Cipher StepsVigenère Cipher Steps

h o l d h o l d h o l d h o l dh o l d h o l d h o l d h o l dt h i s t h e p l a i n t e x tt h i s t h e p l a i n t e x t

Page 28: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Vigenère ExampleVigenère Example

Using the keyword “hold”Using the keyword “hold”

h o l d h o l d h o l d h o l dh o l d h o l d h o l d h o l dt h i s t h e p l a i n t e x tt h i s t h e p l a i n t e x t

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

a

So, “t” becomes “a” butSo, “t” becomes “a” butat the end “t” becomes “w”at the end “t” becomes “w”

w

Page 29: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Cryptanalysis of Cryptanalysis of PolyalphabeticsPolyalphabetics

While difficult, these are not immuneWhile difficult, these are not immune

Basic strategy is to determine the Basic strategy is to determine the number of alphabets used to number of alphabets used to encrypt, and then…encrypt, and then… break message into its monoalphabetic break message into its monoalphabetic

components andcomponents and solve each of these as beforesolve each of these as before

Page 30: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

KASISKI METHODKASISKI METHODfor repeated patternsfor repeated patterns

Relies on frequency of letter patterns such Relies on frequency of letter patterns such asas-th, -ing, in-, un-, re-, of, and, to-th, -ing, in-, un-, re-, of, and, to

If message enciphered with n alphabets in If message enciphered with n alphabets in cycliccyclicrotation and a word appears k times in rotation and a word appears k times in plaintext,plaintext,it should be enciphered approximately k/n it should be enciphered approximately k/n timestimesfrom same alphabetfrom same alphabet

Page 31: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

KASISKI METHODKASISKI METHODExample using Dickens' workExample using Dickens' work

dicke nsdic kensd ickedicke nsdic kensd icken sdick enn sdick ensdi ckens dickesdi ckens dickeitwas thebe stoft imesitwas thebe stoft imesi twast hei twast hewor stoft imesiwor stoft imesi

nsdic kensd icken sdick ensdi ckens dicke nsdicnsdic kensd icken sdick ensdi ckens dicke nsdictwast heage ofwis domit wastn eageo ffool ishnetwast heage ofwis domit wastn eageo ffool ishne

kekensd ickennsd icken sdick ensdi cke sdick ensdi ckens dicke nns dicke nsdic kensdsdic kensdssssitw astheitw asthe epoch ofbel ief epoch ofbel iefit wasth eit wasth eepoc hofinepoc hofin

IT WAS THEIT WAS THE is encrypted using keyword is encrypted using keyword nsdickennsdicken three times three timesabove, once in the first line, twice in the third lineabove, once in the first line, twice in the third line

These all appear as identical 8-character ciphertextThese all appear as identical 8-character ciphertextpatterns. Distance between repeated patterns is a multiplepatterns. Distance between repeated patterns is a multipleof keyword length. Any repeated pattern over 3 charactersof keyword length. Any repeated pattern over 3 charactersis probably not accidental.is probably not accidental.

Page 32: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Kasiski Method cont’dKasiski Method cont’dAlthough many 2-letter combinations are coincidental, Although many 2-letter combinations are coincidental, the probability of 4-letter coincidences is only the probability of 4-letter coincidences is only 0.00000210.0000021Once a repeated phrase has been found, compute the Once a repeated phrase has been found, compute the distance to the next occurrence and determine the distance to the next occurrence and determine the factors for that distance.factors for that distance.Repeat as necessary and determine most likely factorsRepeat as necessary and determine most likely factors

Starting Starting Distance fromDistance from FactorsFactors

PositionPosition Previous Previous

2020 ----------- ----------- --------------------------

8383 63 (83-20) 63 (83-20) 3, 7, 9, 21, 633, 7, 9, 21, 63

104104 21 (104-83) 21 (104-83) 3, 7, 213, 7, 21

3 or 7

Page 33: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Steps in the Kasiski MethodSteps in the Kasiski Method

Identify repeated patterns of 3 or more charactersIdentify repeated patterns of 3 or more characters

For each pattern, note the position at which eachFor each pattern, note the position at which eachinstance of the pattern beginsinstance of the pattern begins

Note the difference between starting points ofNote the difference between starting points ofsuccessive instancessuccessive instances

Compute factors of each difference; key length isCompute factors of each difference; key length islikely to be one of the factors that appears oftenlikely to be one of the factors that appears often

Then try to divide message into pieces encipheredThen try to divide message into pieces encipheredwith same alphabetwith same alphabet

Page 34: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Index of CoincidenceIndex of Coincidence

Once a key length is selected (3 or Once a key length is selected (3 or 7), divide the encrypted message 7), divide the encrypted message into that into that number of sub-messages.number of sub-messages.

Compare frequency distributions to Compare frequency distributions to English to determine whether a English to determine whether a particular set was used to encrypt.particular set was used to encrypt.

M1 = {c1,c4,c7,… } M2 = {c2,c5,c8,… } M3 = {c3,c6,c9,… }

Page 35: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Roughness of Distribution Roughness of Distribution of English Text of English Text

0

2

4

6

8

10

12

14

16

a c e g i k m o q s u w y

Per

cent

English

Flat 1/26

Page 36: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Index of CoincidenceIndex of Coincidence

NUMBER OFNUMBER OFALPHABETSALPHABETS

INDEX OFINDEX OFCOINCIDENCECOINCIDENCE

11 0.0680.068

22 0.0520.052

33 0.0470.047

44 0.0440.044

55 0.0440.044

1010 0.0410.041

largelarge 0.0380.038

z

ai

ii

nn

FreqFreqIC

)1(

)1(

If we have lots of ciphertext AND underlying If we have lots of ciphertext AND underlying plaintext has a fairly standard distribution of plaintext has a fairly standard distribution of letters, THEN can use IC:letters, THEN can use IC:

Page 37: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Decrypting Decrypting PolyalphabeticsPolyalphabetics

Use Kasiski method to predict likelyUse Kasiski method to predict likelynumber of enciphering alphabets. Ifnumber of enciphering alphabets. Ifit does not work, then encryption isit does not work, then encryption isprobably not simply a polyalphabeticprobably not simply a polyalphabeticsubstitution.substitution.

Separate ciphertext into appropriateSeparate ciphertext into appropriatesubsets and independently compute ICsubsets and independently compute ICfor each subset (should be near 0.068)for each subset (should be near 0.068)

Use frequency analysis on each subsetUse frequency analysis on each subset

Page 38: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

The Perfect Substitution The Perfect Substitution CipherCipher

Use many alphabets to produce a perfectly flat Use many alphabets to produce a perfectly flat distribution with no recognizable pattern for distribution with no recognizable pattern for the choice of any alphabet at any given point.the choice of any alphabet at any given point.

Suppose the Vigenère Tableau were extended Suppose the Vigenère Tableau were extended infinitely with a random keyinfinitely with a random key

Would defy the Kasiski Method. Any repeat Would defy the Kasiski Method. Any repeat encryptions would be purely coincidentalencryptions would be purely coincidental

IC = 0.038 suggesting a totally random IC = 0.038 suggesting a totally random encryption.encryption.

Page 39: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

One-time PadsOne-time Pads

Called the perfect cipher because it uses an Called the perfect cipher because it uses an arbitrarily long encryption keyarbitrarily long encryption key

Sender and receiver are provided a book of Sender and receiver are provided a book of keys and encryption tableaus. If each key keys and encryption tableaus. If each key has length = 20, then a 300 letter message has length = 20, then a 300 letter message would require 15 keys pasted adjacently. would require 15 keys pasted adjacently. After encryption and subsequent decryption, After encryption and subsequent decryption, both sender and receiver destroy the keys.both sender and receiver destroy the keys.

No key is ever used twice.No key is ever used twice.

Page 40: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Problems with One-time Problems with One-time PadsPads

Requires absolute synchronization Requires absolute synchronization between sender and receiverbetween sender and receiver

Need exists for an unlimited number Need exists for an unlimited number of keysof keys

Publishing, distributing and securing Publishing, distributing and securing keys is a major problem - an keys is a major problem - an administrative burdenadministrative burden

Page 41: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Use Of Random NumbersUse Of Random Numbers

Approximates one-time padsApproximates one-time pads computer generated random numbers computer generated random numbers

must be scaled to the interval must be scaled to the interval [0, 25][0, 25] Requires complete synchronization Requires complete synchronization

between sender and receiverbetween sender and receiver RN Generators are not truly random, RN Generators are not truly random,

and given enough ciphertext, they and given enough ciphertext, they can be brokencan be broken

Page 42: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Random Number Random Number GeneratorsGenerators

Many encryption algorithms rely on Many encryption algorithms rely on random numbersrandom numbers

RNGs produce long period sequences but RNGs produce long period sequences but the cycle eventually repeatsthe cycle eventually repeats

The The linear congruential RNGlinear congruential RNG is the most is the most common type - requires a common type - requires a seed valueseed value

NEW_RANDNO := (A*OLD_RANDNO + B) NEW_RANDNO := (A*OLD_RANDNO + B) mod mod N N

A, B and N are constants;A, B and N are constants;seed number and B must be prime relative to Nseed number and B must be prime relative to N

Page 43: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

The Vernam CipherThe Vernam Cipher

Named after its developer, Gilbert Named after its developer, Gilbert Vernam who worked for AT&TVernam who worked for AT&T

Vernam used a punched paper tape Vernam used a punched paper tape containing a long series of non-containing a long series of non-algorithmic random numbers to algorithmic random numbers to produce the ciphertextproduce the ciphertext

Keys destroyed after a single use to Keys destroyed after a single use to make them immune to analysismake them immune to analysis

Page 44: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Vernam ModelVernam Model

Plaintext

Long Random Number Sequence

CiphertextOriginalPlaintext

Encryption Decryption

denotes an XOR or other combining function

Page 45: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Vernam ExampleVernam Example

V E R N A M C I P H E R21 4 17 13 0 12 2 8 15 7 4 1776 48 16 82 44 3 58 11 60 5 48 8897 52 33 95 44 15 60 19 75 12 52 10519 0 7 17 18 15 8 19 23 12 0 1T A H R S P I T X M A B

plaintextnumeric equivalent+ random number= sum mod 26ciphertext

Page 46: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Probable Word AttacksProbable Word Attacks

Given the structure of the linear Given the structure of the linear congruential RNG, assume the first few congruential RNG, assume the first few ciphertext characters represent some ciphertext characters represent some likely word such as ‘MEMO,’ ‘DATE’ or likely word such as ‘MEMO,’ ‘DATE’ or ‘FROM’‘FROM’

Inserting the numeric equivalents for the Inserting the numeric equivalents for the plaintext probable words, a system of plaintext probable words, a system of simultaneous equations can be simultaneous equations can be developed and solveddeveloped and solved

Page 47: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

Long Sequences from BooksLong Sequences from Books

Use the phone book (middle two digits of a Use the phone book (middle two digits of a telephone number make a good RN)telephone number make a good RN) RN RN modmod 26 defines the Vigenère key column 26 defines the Vigenère key column

Use a novel for a nonrepeating keyUse a novel for a nonrepeating key Problem is that both key and plaintext have the Problem is that both key and plaintext have the

same frequency distributionsame frequency distribution also {a,e,i,n,o,t} make up 50% of all letter also {a,e,i,n,o,t} make up 50% of all letter

occurrences in English. Probability that they map occurrences in English. Probability that they map to same subset is 0.25to same subset is 0.25

leads to a reduced Vigenère Tableau and some leads to a reduced Vigenère Tableau and some effective guessingeffective guessing

Page 48: Classical Cryptography I CS432 - Security in Computing Copyright © 2005, 2010 by Scott Orr and the Trustees of Indiana University

CRYPTOANALYTIC TOOLSCRYPTOANALYTIC TOOLSFOR SUBSTITUTION CIPHERSFOR SUBSTITUTION CIPHERS

Frequency distributionFrequency distribution

Index of coincidenceIndex of coincidence

Consideration of highly likely lettersConsideration of highly likely lettersand probable wordsand probable words

Pattern analysis and Kasiski approachPattern analysis and Kasiski approach

Persistence, organization, ingenuity, and Persistence, organization, ingenuity, and luckluck