copyright 1998–2005 Steve J. Hodges   http://steveh.net/cs19/cs19-hw06.html

CS19 Spring 2010

Assignment 6 (Solitaire Encryption)

Directory Name

19-6

Resulting Executable

p6

Description of the program

In this assignment you will code a simplified version of Bruce Schneier's Solitaire Encryption Algorithm. Your program will be able to encrypt or decrypt messages.

Here's a description of the algorithm that you will implement:

You may use either your own doubly linked list implementation or a STL sequence container (your preference) to hold the deck of cards.

Your program should be used as described below.

./p6 e deck.txt
./p6 d deck.txt

Sample deck data file (containing the two digit, space separated integer values 01-28 on one line.)

Sample Run

$ ./p6 e deck.txt
Enter message to be encrypted (non-letters ignored)
This is a test.
Plaintext message is: THISISATESTXXXX
The encrypted message is: IBSRPGWASOPKXKU

If the user omits the name of the deck file on the command line, prompt the user for the file name before prompting for the text to encrypt or decrypt. If the user omits the "e" or "d" command line parameter, the program should quit after printing a usage message. After you have printed out the results, your program should quit (i.e. do not encode or decode multiple strings in one program invocation.)

A sample message encrypted with the provided deck file: TGKHSAAFCQNAAZBNQPXMZBVHLLYRDAQSEJEEXAUDIQLIGFHPNMLSVOBTSSCY
another one:
UIBDCSJTCNARXGOJFEKRSBDEZHDYEKAWRATVDCYMCLQAGNVPHELBAMWDJCZVEGFMHYNQHFCKFXROWNJSNKDABCOKDLHAKCLQUEYY