PATH // Home > Projects > University Projects > OTP Encryption

One-Time Pad Encryption

This is another first year project, which uses a one-time pad to encrypt a simple text based message. The output file and key can then be used to reconstruct the original message.

This program encrypts text by XORing an input character with a randomly generated key character, and then writing both to files. The message can then be restored by simply XORing the output character to it's corresponding key character.

A one time pad is theoretically impossible to break by analysing a succession of messages, as each encryption is unique. However, the decrypting party must have a copy of the same key used for encryption, so it is only secure as long as the key remains secret.

Because this program uses pseudo-randomly generated numbers using the c standard libraries, the key can easily be reconstructed. If you're looking for secure, reliable one-time pad software, you've come to the wrong place. However,if you only want to see how OTP encryption works, feel free to give it a try.

  Usage:  encrypt [options]
  Where [options] include:
  
  -e             select encryption mode
  -d             select decryption mode
  -i [infile]    set input file (default in.txt)
  -k [keyfile]   set key file (default key.txt)
  -o [outfile]   set output file (default out.txt)
  -debug         enable debug output

Screenshot
Download