Course Assignment:
Write a C program to implement a Vigenre cipher, which will be used to encrypt plain text and
decrypt cipher text to a text file.
The program must do the following:
Initially, the cipher key must be declared and initialised in the source code with the following
information:
The length of the cipher key must be the length of your surname/family name
The first two letters of the cipher should be from your first name
The next two letters from your surname/family name
(If) any letters are needed after that, they should be made up of your middle name or
mother name.
For example, my key would be nine characters long and initialised as JOROJAMES
Provide a menu-based system, which allows the user to select an option to either 1) encrypt
2) decrypt, 3) enter a new key or 4) exit. The menu system must loop if either option one,
two or three has been selected.
For option 4, the exit should return the correct value to indicate end of the program.
For option 3, the program should request the user to enter a cipher key as string, which must
between 2 to 16 characters in length and may only contain lower case characters of the
alphabet (a-z). It should not accept other characters e.g. 0,1,2,3,4.. !, ?, #, {, }
For options 1 and 2; the program should load a text file which must be at least 5 to 256
characters in length and contain only lowercase characters of the alphabet (a-z) and white
spaces. Decryption should overwrite any previous text but both options must use the same
text file.
All output of encrypted and decrypted text should be saved as a text (.txt) document
Additionally, the program must display the following output:
For encryption; The number of places each plain text letter moves by according to
the key, e.g. if the key is ABC and the text is 4 characters long move first plain text
character by 0, second by 1, third by 2 and fourth by 3. An output message should
display the number of steps moved for each character and,
The resulting encrypted text at each step
Finally, a confirmation that the entirety of the encrypted/cipher text has been saved to
a .txt file
The previous three steps should be in place for the decryption cycle but by reversing
or applying the required changes for encrypted text to plain text
The coursework must contain pseudo code of the solution at the top program (enclosed with
source code comments delimiters). Source code comments are required to explain the
implementation.
Programs may be able to be written in different IDEs but must be compliable with CodeBlocks.
Reviews
There are no reviews yet.