1 / 25

Cryptanalysis

Cryptanalysis. With thanks to Professor Sheridan Houghten. Example 1.11: Ciphertext obtained from a Substitution Cipher. YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR.

mandy
Download Presentation

Cryptanalysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cryptanalysis With thanks to Professor Sheridan Houghten

  2. Example 1.11: Ciphertext obtained from a Substitution Cipher YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR COSC 4P03 Week 8

  3. Table 1.3: Frequency of Occurrence of 26 Ciphertext Letters COSC 4P03 Week 8

  4. Breaking the Substitution Cipher Compare the frequency of encrypted letters with known frequencies (given in graph). Also look for commonly occurring bigrams such as 'th'.

  5. Bigrams and Trigrams • Most common bigrams are: TH, HE, IN, ER, AN, RE, ED, ON, ES, ST, EN, AT, TO, NT • Most common trigrams are: THE, ING, AND, HER, ERE, ENT, THA, NTH, WAS, ETH, FOR, DTH

  6. Guess Z=e, ZW = ed, R = n ------end---------e----ned---e------------ YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ --------e----e---------n--d---en----e----e NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ -e---n------n------ed---e---e--ne-nd-e-e-- NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ -ed-----n-----------e----ed-------d---e--n XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR COSC 4P03 Week 8

  7. Guess N=h, C=a ------end-----a---e-a--nedh--e------a----- YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ h-------ea---e-a---a---nhad-a-en--a-e-h--e NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ he-a-n------n------ed---e---e--neandhe-e-- NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ -ed-a---nh---ha---a-e----ed-----a-d--he--n XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR COSC 4P03 Week 8

  8. Guess M=i -----iend-----a-i-e-a-inedhi-e------a---i- YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ h-----i-ea-i-e-a---a-i-nhad-a-en--a-e-hi-e NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ he-a-n-----in-i----ed---e---e-ineandhe-e-- NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ -ed-a--inhi--hai--a-e-i--ed-----a-d--he--n XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR COSC 4P03 Week 8

  9. Guess Y=o, D=s, F=r, H=c, J=t o-r-riend-ro--arise-a-inedhise--t---ass-it YIFQFMZRWQFYVECFMDZPCVMRZWNMDZVEJBTXCDDUMJ hs-r-riseasi-e-a-orationhadta-en--ace-hi-e NDIFEFMDZCDMQZKCEYFCJMYRNCWJCSZREXCHZUNMXZ he-asnt-oo-in-i-o-redso-e-ore-ineandhesett NZUCDRJXYYSMRTMEYIFZWDYVZVYFZUMRZCRWNZDZJJ -ed-ac-inhischair-aceti-ted--to-ardsthes-n XZWGCHSMRNMDHNCMFQCHZJMXJZWIEJYUCFWDJNZDIR COSC 4P03 Week 8

  10. Subsitution Cipher – Plaintext “Our friend from Paris examined his empty glass with surprise, as if evaporation had taken place while he wasn’t looking. I poured some more wine and he settled back in his chair, face tilted up towards the sun” COSC 4P03 Week 8

  11. Cryptanalysis of Vigenere Cipher • Repetition of the key is it’s weakness • There are two methods – the Kasiski test and index of coincidence analysis. • Kasiski Test: see if something is being repeated, then the key length is probably divisible by that length • Perform a separate frequency analysis for each offset

  12. Kasiski Test • We see that the trigram CHR occurs five times in the text. • The positions of these trigrams are 1, 166, 236, 276, 286. • The distances from the first occurrence to the others are 165, 235, 275, and 285. • The GCD of these numbers is 5. • Guess that the key length is 5. • Then perform frequency analysis on the five groups of letters to get the five shift values.

  13. Index of Coincidence (Simple Version) • If we take a random string of letters, shift it a random amount, then write one line above the other. • suctyewlgilewpxzkwmcoielvutymvnb • suctyewlgilewpxzkwmcoielvutymvnb • What are the odds that letters directly above and below each other will be the same? • The answer is 1/26 or about .038 • English text has an index of coincidence of about .065 because letters do not occur randomly. • Thisisanenglishsentence • Thisisanenglishsentence

  14. Suppose we have some text from a Vigenere cipher that has been encrypted with the word “computer”. • Computercomputercomputercomputer • qoiulkdautwjvvdkfguwitgksaaitjak • qoiulkdautwjvvdkfguwitgksaaitjak • As we slide the line over and check the index of coincidence, we will find it is around .038 until letters that have the same offset are above and below each other. Then it will suddenly jump to around .065. • Computercomputercomputercomputer • qoiulkdautwjvvdkfguwitgksaaitjak • qoiulkdautwjvvdkfguwitgksaa • Now we know the length of the encryption phrase.

  15. Although this simple version of the index of coincidence will work, it does not make good use of all available data. • We are only comparing each letter with one other letter. We can get a more accurate result by comparing each letter with all other letters. • Thisisanenglishsentence • Thisisanenglishsentence • There are n choose 2 possible letter pairings • We will use this version of the index of coincidence to analyze a Vigenere ciopher. Etc.

  16. Example 1.11: Ciphertext obtained from a Vigenere Cipher CHREEVOAHMAERATBIAXXWTNXBEEOPHBSBQMQEQERBW RVXUOAKXAOSXXWEAHBWGJMMQMNKGRFVGXWTRZXWIAK LXFPSKAUTEMNDCMGTSXMXBTUIADNGMGPSRELXNJELX VRVPRTULHDNQWTWDTYGBPHXTFALJHASVBFXNGLLCHR ZBWELEKMSJIKNBHWRJGNMGJSGLXFEYPHAGNRBIEQJT AMRVLCRREMNDGLXRRIMGNSNRWCHRQHAEYEVTAQEBBI PEEWEVKAKOEWADREMXMTBHHCHRTKDNVRZCHRCLQOHP WQAIIWXNRMGWOIIFKEE COSC 4P03 Week 8

  17. Index of Coincidence • m=1: 0.045 • m=2: 0.046, 0.041 CREOHART… HEVAMEAB… • m=3: 0.043, 0.050, 0.047 CEOMRBX… HEAAAIX… RVHETAW… • m=4: 0.042, 0.039, 0.046, 0.040 CEHRIW… HVMAAT… ROATXN… EAEBXX… • m=5: 0.063, 0.068, 0.069, 0.061, 0.072 CVABW… HOEIT… RARAN… EHAXX… EMTXB… COSC 4P03 Week 8

  18. Table 1.4: Values of Mg COSC 4P03 Week 8

  19. Vigenere Cipher – Plaintext “The almond tree was in tentative blossom. The days were longer, often ending with magnificent evenings of corrugated pink skies. The hunting season was over, with hounds and guns put away for six months. The vineyards were busy again as the well-organized farmers treated their vines and the more lackadaisical neighbors hurried to do the pruning they should have done in November.” COSC 4P03 Week 8

  20. LFSR Stream Cipher Recall: • ciphertext element yi = (xi + zi) mod 2, where xi = corresponding plaintext element zi = corresponding keystream element • keystream produced from (z1, …, zm) by zm+i = mod 2 for constants c0, …, cm-1 • For n ≥ 2m, there are m linear equations in m unknowns COSC 4P03 Week 8

  21. Cryptanalysis of LFSR Stream Cipher Plaintext: x1 x2 … xn Ciphertext: y1 y2 … yn zm+i = Σj=0 to m-1 cj * zi+j (zm+1, zm+2, …, z2m) = (c0, c1, …, cm-1) * -1 (c0, c1, …, cm-1) = (zm+1, zm+2, …, z2m) * COSC 4P03 Week 8

  22. LFSR Stream Cipher – Example Ciphertext: 011001111111000 Plaintext: 101101011110010 So keystream is 110100100001010 Suppose Oscar knows m=5: (0,1,0,0,0) = (c0, c1, …, cm-1) * COSC 4P03 Week 8

  23. LFSR – Example Continued So the recurrence used to generate the keystream is zi+5 = (zi + zi+3 mod 2) Then (c0, c1, …, c4) = (0, 1, 0, 0, 0) * = (1,0,0,1,0) COSC 4P03 Week 8

  24. Information Theory • Probability a given plaintext x was sent: p(X=x) • Σall possible plaintexts x(p(X=x)) = 1 • Probability a given key k was used: p(K=k) • Σall possible keys k(p(K=k)) = 1 • Probability a given ciphertext y was received: p(Y=y) • For each possible y, p(Y=y) = Σ(p(K=k)*p(X=dK(y))) • for all keys k such that y is a ciphertext from key k • Probability x was sent, assuming we know y was received: p(X=x|Y=y) or p(x|y) • Perfect secrecy: p(x|y) = p(X=x) • intercepting ciphertext gives cryptanalyst no additional information. COSC 4P03 Week 8

  25. Perfect Secrecy (see section 2.3) - example for Shift Cipher • 31-character ciphertext from a shift cipher: y = LZWJWAKFGGLZWJDSFYMSYWTMLXJWFUZ • Number of possible keys < number of possible English sentences of length 31 → perfect secrecy not achieved. • Just try all 26 keys. Only one (K=18) produces a meaningful message: y = LZWJWAKFGGLZWJDSFYMSYWTMLXJWFUZ x = Thereisnootherlanguagebutfrench

More Related