10/6/08 - 10/12/08: One-Time Pad Decryption

UPE is happy to present the second challenge in our series. This problem is courtesy of Professor Lauer and deals with decryption. The prize for the winning submission will again be a $25 gift card to Amazon.com.

A one-time pad (see http://en.wikipedia.org/wiki/One_time_pad) has been "inadvertently" used to encrypt two different messages. The two encrypted messages are in the files text1-encrypted.txt and text2-encrypted.txt.

Each message was originally written in the ASCII characters of a character set enumerated in the attached file characterSet.txt. This character set has n characters in it, including \n. The one time pad was generated by a random process.

Text is encrypted as follows. The i-th character of message is looked up in the character set. Let's say its position in the character set is j[i]. Then the encrypted character is in the position (j[i]+r[i])%n of the character set. This is converted back to ASCII and printed in the encrypted text file.

Your challenge is to recover the two original messages and the one-time pad. Write a program that either (a) decodes both messages directly, or (b) interactively assists the user in decoding the messages.

Submissions will be judged by their correctness and efficiency. Please include a written explanation demonstrating both.

Please send all entries to upe@wpi.edu by Monday, October 13th. Good luck!

Winning Solution

Congratulations to Dan Bjorge for entering the winning submission: 002-twotimepad.zip (002-twotimepad.tar) and 002-readme.txt
The solution is an exported Eclipse project and you will need the Eclipse PyDev plugin to run it from within Eclipse, or using just run using Python /src/decryption/main.py