Using the encryption and decryption methods, write a program called SDESMitm.java or sdesmitm.py that will carry out a meet-in-the-middle attack on 2SDES. This system encrypts a plaintext first with one key and then again with a different key. Please review the attack in the notes and the textbook. Recall that this is a known-plaintext attack. I will provide plaintext/ciphertext pairs. Based on those, you should be able to recover the two 9-bit keys.
Write the program so that it can be run from the command line taking four parameters:
Two pairs are needed because the first plaintext/ciphertext pair will let you create a short list of key pairs and the second plaintext/ciphertext pair will allow you to narrow that list down to one key pair. When run, the program should print the two keys.
You can test your program on the plaintext/ciphertext pairs 0/247; 4095/2808. In my implemenation, the firat plaintext/ciphertext pair yields a list containing 51 key pairs. The second plaintext/ciphertext pair yields a list of 62 key pairs. These two key pair lists have one pair in common.
Warning! Your program must use intelligent data structures! Use a hash map for the first list so that, as you create the second list, you can look up the values quickly. Any solution that performs linear searches on the first list or (worse) produces two lists and then uses linear searches to find matches will lose a lot of points. Needless to add that there should not be any nested loops.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here