360 likes | 580 Views
Codes, Ciphers, and Cryptography-Ch 2.2. Michael A. Karls Ball State University. Breaking the Vigen ère Cipher. Suppose we have intercepted the following ciphertext (handout):
E N D
Codes, Ciphers, and Cryptography-Ch 2.2 Michael A. Karls Ball State University
Breaking the Vigenère Cipher • Suppose we have intercepted the following ciphertext (handout): • DBZMG AOIYS OPVFH OWKBW XZPJL VVRFG NBKIX DVUIM OPFQL VVPUD KPRVW OARLW DVLMW AWINZ DAKBW MMRLW QIICG PAKYU CVZKM ZARPS DTRVD ZWEYG ABYYE YMGYF YAFHL CMWLW LVCHL MMGYL DBZIF JNCYL OMIAJ JCGMA IBVRL OPVFW OBVLK OPVUJ ZDVLQ XWDGG IQEYF BTZMZ DVRMM ANZWA ZVKFQ GWEAL ZFKNZ ZZVCK VDVLQ BWFXU CIEWW OPRMU JZIYK KWEXA IOIYH ZIKYV GMKNW MOIIM KADUQ WMWIM ILZHL CMTCH CMINW SBRHV OPVSO DTCMGHMKCE ZASYD JKRNW YIKCF OMIPS GAFZK JUVGM GBZJD ZWWNZ ZVLGT ZZFZS GXYUT ZBJCF PAVNZ ZAVWS IJVZG PVUVQ NKRHF DVXNZ ZKZJZ ZZKYP OIEXX MWDNZ ZQIMH VKZHY DVKYD GQXYF OOLYK NMJGS YMRML JBYYF PUSYJ JNRFH CISYL N • We suspect that this message may have been enciphered using a Vigenère cipher. • How can we decipher the message?
Breaking the Vigenère Cipher (cont.) • In order to get an idea of what to do, consider the following example. • In this example, the keyword VENUS is used with our Vigenère square handout to encipher a message!
Breaking the Vigenère Cipher (cont.) • Example 3: Use the keyword VENUS and the Vigenère square to encipher “the cat in the hat is near the mat”. • Solution: plaintext ciphertext plaintext ciphertext
Breaking the Vigenère Cipher (cont.) • How is the word “the” enciphered? • “the” OLR, NZZ, and OLR plaintext ciphertext plaintext ciphertext
Breaking the Vigenère Cipher (cont.) • How is the word “the” enciphered? • “the” OLR, NZZ, and OLR plaintext ciphertext plaintext ciphertext
Breaking the Vigenère Cipher (cont.) • The third occurrence of “the” is the same as the first because the same key letters are used to encrypt the t, h, and e. • Different key letters are used for the second “the”. plaintext ciphertext plaintext ciphertext
Breaking the Vigenère Cipher (cont.) • Notice that the distance between the “t” in the first “the” and the “t” in the third “the” is 20 letters. • 20 is a multiple of the length of the keyword VENUS, which has 5 letters! plaintext ciphertext plaintext ciphertext
Breaking the Vigenère Cipher (cont.) • This is true forVigenère ciphers in general! • If a plaintext sequence is repeated at a distance that is a multiple of the length of the keyword, then the corresponding ciphertext sequences are also repeated. • Handout example (Fig. 2.3 from Beutelspacher).
Breaking the Vigenère Cipher (cont.) • In 1854, Charles Babbage used this idea to guess the length of a keyword for a Vigenère cipher! • John Hall Brock Thwaites claimed to have invented a new cipher. • Babbage told Thwaites that his cipher was the Vigenère cipher. • Thwaites challenged Babbage to break his cipher. • Babbage never published this idea—why? • In 1863 Friedrich Wilhelm Kasiski independently discovered the idea of looking for repeated ciphertext sequences to find a Vigenère cipher’s key length.
The Kasiski Test • Look for repeated sequences of three or more letters in a ciphertext. • Equal pairs can occur too often to be of use. • Find the distances between these repeated sequences and list the factors of each distance. • For example, if the distance is d = 18 letters, then the factors are 1, 2, 3, 6, 9, and 18.
The Kasiski Test (cont.) • Look for the most commonly occurring factors greater than 1. • A keyword of length 1 corresponds to a monoalphabetic cipher! • The most commonly occurring factors are candidates for the length L of the keyword.
The Kasiski Test (cont.) • When using the Kasiski Test, keep the following in mind: • Ciphertext sequences may repeat accidentally at a distance that is not a multiple of the keyword length. • The most commonly occurring factors found in in Step 3 of the Kasiski Test may be a factor of the keyword length! • Therefore, one may need to consider multiples of possible keyword lengths as potential keyword lengths!
The Kasiski Test (cont.) • Example 4: Apply the Kasiski Test to the following ciphertext, which is suspected of being a Vigenere cipher! • ZRZNSPCWQGFWLWQGFRGRZNSTZBGTRMNEOXCXRPUBSEYWQGHLSIJKGWDSXSSLSIXKKUJPHKBWHW • For Step 1 of the test, see Simon Singh's Vigenère Cipher Cracking Tool.
The Kasiski Test (cont.) • Other ways to find distances between repeated sequences of ciphertext: • Use a program on the web – check with Google, but watch out for viruses! • Use Microsoft Word’s Find and Replace feature. • The only drawback is you have to find the repeated sequences “by hand”.
The Kasiski Test (cont.) • Step 2: Make a table of the distances and their factors greater than or equal to two. Factors of Distances
The Kasiski Test (cont.) • Step 2: Make a table of the distances and their factors greater than or equal to two. Factors of Distances
The Kasiski Test (cont.) • Step 2: Make a table of the distances and their factors greater than or equal to two. Factors of Distances
The Kasiski Test (cont.) • Step 2: Make a table of the distances and their factors greater than or equal to two. Factors of Distances
The Kasiski Test (cont.) • Step 2: Make a table of the distances and their factors greater than or equal to two. Factors of Distances
The Kasiski Test (cont.) • Step 3: The most commonly occurring factors in the table are 2, 3, and 6. Factors of Distances
The Kasiski Test (cont.) • The greatest common divisor of all distances between repeated sequences of ciphertext is 6. • Guess that the keyword length is L = 6. • Note that L = 12, 18, or 30 could be possible (these are multiples of 6). Factors of Distances
Using Frequency Analysis to Attack the Vigenère Cipher • As Example 4 shows, we can use the Kasiski Test to get an idea of the keyword length for a Vigenère cipher. • Now that we “know” the keyword length, how do we use this information to break the cipher? • Note that each time a certain keyword letter is used to encrypt, the same row of the Vigenere square is used, i.e. the same cipher alphabet is used! • Therefore, we can apply frequency analysis to the subsets of the ciphertext encrypted with each keyword letter!
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) • For example, suppose the keyword in the cipher of Example 4 is six letters long. • Write the keyword as S1S2S3S4S5S6, with unknown letters Si to be determined. • Split up the ciphertext in the following way:
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 Column 1 is encrypted by S1 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 Column 2 is encrypted by S2 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 Column 3 is encrypted by S3 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 Column 4 is encrypted by S4 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 Column 5 is encrypted by S5 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) Letter Si of keyword i i+6 Position of letter in keyword i+12 i+18 Column 6 is encrypted by S6 i+24
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) • Since the letters in column 1 are encrypted by the same cipher alphabet, we can use frequency analysis on this set of cipher letters to figure out keyword letter S1. • Repeat with column 2 letters to find S2, etc. • In this way, frequency analysis is used to crack a Vigenere cipher!
Using Frequency Analysis to Attack the Vigenère Cipher (cont.) • Example 5: The Kasiski Test has been applied to the Vigenère ciphertext below. Assuming that the keyword has length 5, find the subsets of ciphertext encrypted with each letter. Use frequency analysis to determine each keyword letter! • DBZMG AOIYS OPVFH OWKBW XZPJL VVRFG NBKIX DVUIM OPFQL VVPUD KPRVW OARLW DVLMW AWINZ DAKBW MMRLW QIICG PAKYU CVZKM ZARPS DTRVD ZWEYG ABYYE YMGYF YAFHL CMWLW LVCHL MMGYL DBZIF JNCYL OMIAJ JCGMA IBVRL OPVFW OBVLK OPVUJ ZDVLQ XWDGG IQEYF BTZMZ DVRMM ANZWA ZVKFQ GWEAL ZFKNZ ZZVCK VDVLQ BWFXU CIEWW OPRMU JZIYK KWEXA IOIYH ZIKYV GMKNW MOIIM KADUQ WMWIM ILZHL CMTCH CMINW SBRHV OPVSO DTCMGHMKCE ZASYD JKRNW YIKCF OMIPS GAFZK JUVGM GBZJD ZWWNZ ZVLGT ZZFZS GXYUT ZBJCF PAVNZ ZAVWS IJVZG PVUVQ NKRHF DVXNZ ZKZJZ ZZKYP OIEXX MWDNZ ZQIMH VKZHY DVKYD GQXYF OOLYK NMJGS YMRML JBYYF PUSYJ JNRFH CISYL N • Solution: Simon Singh's Vigenère Cipher Cracking Tool.