Hi all this is the 2nd exercise I can't seem to figure out how to do.Exercise goes like this :
One method of encryption is this : We pair the letters of the alphabet to the numbers 0-25.
Assuming we have a text "T" and a keyword "K" of "V" letters.
We add the number of the letter we want to encrypt with the number of the first character of the keyword.If the result is beyond the limits of the alphabet (I assume like 35 for example),we substract 26.Repeat the process with the 2nd character of the text and the 2nd character of the keyword until the end of the text.If we run out of keyword letters we start over from the first letter of the keyword.
The program will be able to take 3 parameters
- enc or - dec : choose whether it'll be encryption or decryption
- cipher <word>: the keyword we'll use (10 chars max)
- <file_name> : our file's name (i.e. test.txt)
an example is :
test.txt (contents) : Attack at dawn.
command line : crypto -enc -cipher lemon test.txt
output : lxfopv mh oeib.
test.enc (contents) : lxfopv mh oeib.
command line : crypto -dec -cipher lemon test.enc
output : Attack at dawn.
I have absolutely NO idea how to do this. Any help would be greatly appreciated.