Please code in C and give 3 files
takes in .dat files such as one-time-pad file
We need cryptography in nearly every facet of our industry. Write a program that prompts the user for three file paths: the source file, the destination file, and the one-time-pad file. The program should use a buffer size of 4096. It will use two buffers to read a buffer-load of data from the source file and a buffer-load of data from the one-time-pad file, XOR them byte by byte, into one of the aforementioned buffers then store that buffer to the destination file. Use pointers and pointer arithmetic to iterate over the buffers. These buffers should be arrays of unsigned chars. Remember that the final buffer that is read from the source file might not be completely filled. You will need to use the value returned by the fread function to know how many bytes were read. This value can control the loop that performs the XOR operation on the two buffers and use it for the size of the buffer that is passed to the fwrite function. Consult the code that was written in class for the file copy program. The same utility will be used for decryption as well. The entire process is exactly the same except your source file will be ciphertext (the encrypted file) and your destination file will be plaintext (the unencrypted file). Be sure to test your program with large files (over 5 MB but less than 10MB). I will provide a one-time-pad (called otp.dat) of 10MB. Use this file for your tests. Write your encryption code in a separate header and C file (named crypth and crypt.c respectively). These files (this module) should contain only the functions that perform the encryption. Write a separate file called main.c that will act as the user interface. "main.c" should get the file paths from the user and call the functions in the crypt module to do the rest of the encryption process. The crypt module should not contain printf or scanf operations (no user interface operations). Be sure to test whether the file operations were successful. If any of the three files were not successfully opened then the program should close any that were opened and exit with a meaningful message. What to Submit Your program files, crypt.h, crypt.c, main.c
Please code in C and give 3 files takes in .dat files such as one-time-pad file
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Please code in C and give 3 files takes in .dat files such as one-time-pad file
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!