Filename this function accepts a reference to size

  • No School
  • AA 1
  • 5

This preview shows page 2 - 4 out of 5 pages.

*file_name) This function accepts a reference to size and a char array with the filename, and returns the allocated char array containing the contents of the file. Size is passed by reference to record the number of bytes in the file. Writing the file will require: Open the file for writing binary Write the string to file using fwrite() Close the file The suggested function header for write_file is: int file_write(unsigned long
Image of page 2

Subscribe to view the full document.

size, char *output, char *file_name) This project will require the use of the read_file() and write_file() from Part 1 and the following functions: 1. main function with a menu including 3 choices: encrypt file, decrypt file and exit program. 2. make_rand_key(length of key, key) generates a fixed length string of random chars. 3. encrypt(clear file, key file, cipher file) generates a random key using make_rand_key(), perform the clear text XOR ket text, byte-by-byte, to produce the cipher text string and write both the random key and cipher text strings to file. 4. decrypt(key file, cipher file, clear file) uses the cipher text XOR random key to recover the original clear text and writes the clear text to a file (make sure to use a different file name than the original file so you can compare the results) The
Image of page 3
Image of page 4

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes