Assignment One

 

                This assignment is about the one time pad cipher. You are to:

 

·       Modify the Vigenere cipher to be a one time pad cipher by using the Java SecureRandom class to generate a random sequence of letters and the space. Map the space back and forth to and from { since it is the character immediately after z in the coding sequence. The seed to the random number generator is the key. You will need to convert back and forth between letters and ints . Your program should prompt the user for a seed and then for a plaintext message. Write a method to encrypt and a method to decrypt. (see the Vigenere cipher programs in the examples). The key should generate a random sequence as long as the message. That is if there are n characters (letters and spaces) in the plaintext use the generator to generate n random “letters” (i.e. ints in the range 0 to 26).

·       Write a discussion of the problems with the one time pad (you can write is as a comment at the end of your program) . Use a known plaintext - ciphertext attack to show how the key can be calculated. Prove this by adding code at the end of your program to calculate the key from the plaintext and the ciphertext.

 

The assignment is due next week on Thursday January 27th.