CSE 539 - Applied Cryptography – HW 2 (2009)

 

Due – March 2nd, 2009, Start of class – 3:30 pm

Method - Print out (Hand written documents will not be accepted, do not e-mail the solutions to TA unless you have no other viable option)

Place your name and e-mail on the document.

 

 

  1. Why is it not useful to run through all possible keys in a key search attack?
  2.  
    1. Explain why buffer overflow attacks exist? What is stack smashing?
    2. Write a small C program that uses buffers in an unsafe fashion and crashes when user exploits these unsafe buffers?
    3. What steps would you take as a programmer to mitigate threats in part b)
    4. What steps could you take as a compiler/OS designer to mitigate threats in part b)

 

  1.  Perform Kasiski to break the Following Vigenere Cipher. Use the following cipher text, you may assume all lower case letters. The plaintext was english. Show the length of the keyword and the plain text (format the plain text for easier reading).

            “myyzbxyrxiygbgbikzmefvnlhuijxewvrgnmgxupiyufxkcgmvrxupowbeaelvlmxjijwzzjxiyrmtuilrlgbgbikjvelvxsgkbievnxximsyreirnivwznmlrmmfgfiyflqhwjsepupiyufxkcgllvwmznymzirmyygbgbikyuwuvyrkvcrovhxxugegpnmfvmxavgimyihprmskzamgrfpruywvicfxuvczziztevemkcwmrviecuwhzhlbjvshbnlxjwlxdyatjfemvlqbjuxmicfnkyhmfvptzmiwvpmzvhikvurwzmrhnqmwvfcdeiagrmxavpmzvhikvwmiyyvmycwvzjlxicwpvfpdeiagsygtlmipycpxznmlvuwrkiyguyvlkurwrhhbdjpxdyrmznsykyrtgjitimxhsykbehikjnsuvoruiyedrvpxtirlvkyxenprdurrgysicyltmyxkzyhmfcqicyqxenigtlcikcsgjwlxdywmyuxtiyiljyrmzupeppmzvhikvwmiyyvlfhprkiltmyxavgfkfeig”

 

  1. This problem modifies the Vignere Cipher to the following form using one time pads. If the key is 3 19 5 …., then the first letter of plaintext is encrypted with a shift of 3 letters, second with a shift of 19 and so on. Example, CAT: 3,5,7 would be FFA
    1. Encrypt SENDMOREMONEY with 9 0 1 7 23 15 21 14 11 11 2 8 9
    2. Take the cipher text produced above, what is the key that would have produced that ciphertext from CASHNOTNEEDED

 

  1. During World War II, many encryption algorithms and methods came up. One such machine was the Enigma Encryption Machine used by the Germans. You can refer to http://en.wikipedia.org/wiki/Enigma_machine  for details of its working.

Suppose Alice created a new machine based out of Enigma. She only used 2 rotors instead of 3. You are given initial rotor orientation for rotor 2. You have to break the encryption to find the plain text. For this you will have to find out the initial rotor position for the first rotor. You may use any method, but describe the method you used. To simplify the problem, the ordering of letters in the rotors will not be jumbled

            Rotor 2: 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

 

            Ciphertext: “dznrcgdflmiwaqfztjuwljwbmbcszz”  [30 characters]

 

           Mechanism of the machine: The first rotor moves by one slot after the first character is typed. Note that its position is read before it is shifted by one slot. If the character A is typed, and A is on the 7th slot, then the character on the 7th slot of rotor two will get printed out.

          

           The shifting is done as follows:

           Rotor 1: The character in slot 1 moves to slot 2, the character in slot 2 goes to slot 3, and so on. The character in slot 26 goes to slot 1.

           Once it has done 26 characters, the first rotor will move, and along with it the 2nd rotor will also move by one slot. Note that the character will be read and then the second slot will move. After that the first rotor will again move another 25 times to the right. After the 52nd character, the second rotor will again move by one slot and so on.

            

           

            Example:

            Rotor 1: jklmnopqrstuvwxyzabcdefghi

            Rotor 2: uvwxyzabcdefghijklmnopqrst

 

            Plaintext: shakespeare

            Ciphertext: dtnytigwtlz