CMSC 201
Programming Project Four
Cryptography
10 Point Extra Credit
STOP !
DO NOT attempt this extra credit work until you have
submitted a perfect working solution to project 4!
Due Date: Before Midnight, 4/25/00
The Background
The encryption method used in this project is simple letter substitution.
But, how is the pattern of letter substitution decided. If you
look closely at the translation files (code1.dat and code2.dat), you will
see that there is a readable "keyword" at the beginning. Following the
keyword is the remainder of the alphabet in order with the letters in the
keyword removed. Let's look at the file code2.dat
rainbowcdefghjklmpqstuvxyz
Following the word "rainbow" the letters of the alphabet not contained
in "rainbow" are listed in order. So the the letter substitution scheme is
a b c d e f g h i j k l m n o p q r s t u v w x y z
r a i n b o w c d e f g h j k l m p q s t u v x y z
'a' becomes 'r', b' becomes 'a', 'c' becomes 'i', etc.
The Task
For 10 points of extra credit, modifiy your working program as follows:
- The command line argument is a "keyword" instead of the name of the translation file
- Write a predicate function named isValidKeyword
that checks that the keyword has no duplicate letters
- Write a function named BuildTable which uses the keyword
as input and produces the 26 character translation table.
- Use the translation table you produced (instead of reading it from
the file) to encrypt and decrypt. This should cause no further changes
to your program.
Help For Extra Credit
There is none. You may ask Ms. Bogar and Mr. Frey for clarifications
about the task, but no one in the Help Center, nor the TAs, nor your
instructor will help you with the extra credit code in any way.
Grading extra credit
All or Nothing. -- No "partial" extra credit.
Be sure your extra credit is working perfectly before
submitting your new project. Don't risk losing points because your
attempt at extra credit causes other parts of your project to fail.
Submitting Your Project
When you've completed your extra credit, resubmit your project.
Your files should still be called proj4.c, crypto.c, crypto.h.
When you resubmit your files, you will be asked if you want to
"overwrite" the files you submitted before -- anwser "yes".
Also, submit a file named "readme" which tells the grader that you
are seeking extra credit.