Due Date: Thursday, November 3, 2005
Points: 100
This program asks you to implement the Vigenère cipher, as discussed in class.
Your program is to be called "vigenere". It should be able to both encipher and decipher text.
Your program is to read text from the standard input. It takes one or two command-line arguments. If the text is to be enciphered, the single argument is the cryptographic key. If the text is to be deciphered, the first argument is to be the option "-d" and the second argument is the cryptographic key.
Your program is to output the text enciphered using the key (if no option is given), or deciphered using the key (if the option -d is given).
Here is an example run for enciphering (input and output). The "%" is a shell prompt: What the user types is in boldface; the output is in normal type:
% vigenere ecs
hello world
lgdpq ostdh
%
Here is an example for deciphering:
% vigenere -d ecs
lgdpq ostdh
hello world
%
You only need to encipher the letters. You also need to preserve case, so capital letters are transformed into capital letters and lower-case letters are transformed into lower-case letters. All other characters should be left untouched.