Question: Create a C-program thats reads in a text-file(specified by the user, prefors a bit-level Exclusive-OR on each byte of the text-file (as a method of

Create a C-program thats reads in a text-file(specified by the user, prefors a "bit-level Exclusive-OR" on each byte of the text-file (as a method of encryption, then writes the encrypted file data back out to disk and gives the encryptd file the same name as the input file (overwrites the original file)

Application- Asks user to enter name of file to be encrypted

User- Enters name of file

Application- Encryps each bye of the input file and writes encrypted data back to the same file, over writing the orginal data.

Create a C-program thats reads in a text-file(specified by the user, preforsa "bit-level Exclusive-OR" on each byte of the text-file (as a method

Thank you!

#include int encrypt data (FILE int main (void) FILE *file ptr; int return code //get file name from user, then do fopen for reading & writing return code E encrypt data file ptr close (file ptr); return 0; int encrypt data (FILE *disk file ptr) int i Used to index through file buffer unsigned long int file size Holds number of bytes in the file int key length; Holds length of encryption key char *file buffer NULL char key Il "ABCDEF" default encryption key, you can change to //something else if you //want e.g. key 12Ygh9sss key length strlen (key) seek (disk file ptr, 0, SEEK END); Move file pointer to end of file file size ft ell (disk file ptr); Get current file pointer location (which will be the size of the file in bytes) rewind (disk file ptr); //Move file pointer back to beginning of file //Next step is to allocate RAM memory to hold all the bytes that are //currently stored on the HardDisk file buffer malloc (file size)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!