General Requirement:
You need to write a C program to record the user input into a file in an encrypted format, and also write a program to decrypt and output the information from an encrypted file . You must use the unix standard I/O library routines read() and write() for your programs.
1: Program for encrypting user input.
When this program runs, the program will ask for the filename and the encryption key. After getting these information, it waits for the user to input data. It reads the user input byte-by-byte from the standard input, then XORs the bytes with the encryption key and writes the encrypted bytes into a file. The program ends when the user enters an EOF (Ctrl+D).
2: Program for decrypting the file.
When this program runs, it asks for the filename and the key for decryption. To ensure the correct decryption, the key must be the same as that used to encrypt the input. The program will read data byte-by-byte from the specified file, then XORs the bytes with the key and write the decrypted bytes to the standard output.
Deliverables
You must submit two C programs. One for encryption and one for decryption.
You must also prepare a
README file that
includes your name, ID, and a brief description of your submission, including the
name of each file submitted along with a one line description of what is in the
file.
Grading
Your assignment will be tested to make sure it works properly. Here are the specifics of the grading:
|
Encryption |
40% |
|---|---|
|
Decryption |
40% |
|
Style/Code structure, etc. |
20% |
NOTE: 20% of your homework grade depends on the how well we can understand your code.
Submitting your files
All projects must be submitted via handin command on any unix machine in the department as follows:
> handin.360.2 1 file1 file2 file3 ...
Please make sure you submit all your source files not the object files. You can also zip the files using the following command first:
> tar cvzf hw1.tgz file1 file2 file3 ...
and submit the single zip file hw1.tgz. Before you submit this single file, please use the following command to check make sure you have everything in this zip file:
> tar tvzf hw1.tgz
Don't send compiled code
Error report
If you find any error in this assignment, please send me an email at jzwang@cs.clemson.edu.