+1(805) 568 7317

one time pad otp encryption when implemented properly cannotbe hacked by cryptanalys 4947698

One Time Pad (OTP) encryption, when implemented properly, cannotbe hacked by cryptanalysis. This method uses the clear text(message to be encrypted), a random key of characters (the samesize of the clear text) and the exclusive OR (XOR) operator. Writea C program with 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 lengthstring of random chars. 3. encrypt(clear file, key file, cipher file) generates a randomkey using make_rand_key(), perform the clear text XOR ket text,byte-by-byte, to produce the cipher text string and write both therandom key and cipher text strings to file. 4. decrypt(key file, cipher file, clear file) uses the ciphertext XOR random key to recover the original clear text and writesthe clear text to a file (make sure to use a different file namethan the original file so you can compare the results). Modify the read_file() and write_file() functions to also acceptan integer argument representing a fixed number of bytes to be reador written. This is to specify the number of bytes to be read fromthe cipher file, which may contain the EOF character, or write tothe cipher text file, which may contain null chars. This isnecessary because the cipher may contain both EOF and characters. This will be explained further below. Sample functioncalls to read_file() and write_file(): 1. read_file(0, clear_file); // Read in a file with of unknownlength, getting the length from the file read. clear_file is astring containing the path to the clear text file. This functionreturns a char array created with memory allocation. 2. read_file(len, clear_file); // Where len > zero, reads lenchars from a file. clear_file is a string containing the path tothe clear text file. This function returns a char array createdwith memory allocation. 3. write_file(0, key, key_file); // Writes a string to fileuntil the char is reached. key is the string of random chars andkey_file is a string containing the path of the text file. 4. write_file(len, cipher, cipher_file); // Where len > zero,writes len chars to a file. cipher is the cipher string of charsand cipher_file is a string containing the path of the textfile. The menu in main() should look like: Encrypt a file: 1 Decrypt a file: 2 Exit: 3 Enter a choice: //main.c #include #include . . .

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon

Order Now