Homework 3, Random Cipher.

Short Description:

Write a program that will encrypt and decrypt messages using a random cipher method.

Goals

When you finish this homework, you should have:

Formal Description

The Caesar cipher encrypted messages by shifting each letter by a fixed amount, normally three. The letter a + 3 = d so a -> d, b -> e, ... x -> a, y->b and z->c. To decrypt this cipher, just reverse the direction. Unfortunately this is an easy cipher to break. You could use other shift amounts, but it has little impact, it is still easy to break the fixed shift cipher.

A more secure simple cipher is the stream cipher. In this method, a pseudorandom stream is used to encrypt the next letter. For this homework you will implement such a cipher.

For this cipher you will use the random number generator rand_r which produces a sequence of pseudorandom values. You need rand_r as you will be encrypting/decrypting multiple streams at once.

To Encrypt a message

Messages can be decoded in a similar manner.

To encrypt a letter

To decode a letter If the encryption and decryption both start with the same seed, the encryption will be reversed by the decryption. It is therefore necessary for both the process encrypting a message/letter and the process decrypting the message/letter to start with the same random seed.

The encryption process will be greatly simplified if you had a "key" class that could

For this project:
  1. 10 points, create a key class.
  2. 10 points, create a test driver to make sure your KeyT class works.
  3. 20 points, create a program that decrypts a series of messages.

Required Files

Submission

Submit the assignment to the D2L folder Homework 3 by the due date.