Question: PLEASE HELP WRITE THE CODE IN C LANGUAGE . THANKS. please comment Intro to C- Lab Assignment 2 File Encryption The XOR operator is something

PLEASE HELP WRITE THE CODE IN C LANGUAGE. THANKS. please comment

PLEASE HELP WRITE THE CODE IN C LANGUAGE. THANKS. please comment Introto C- Lab Assignment 2 File Encryption The XOR operator is something

Intro to C- Lab Assignment 2 File Encryption The XOR operator is something we had not yet introduced in class. It works on the bits that make up the binary representation of a variable, rather than the value of the variable. For example, each char is 1 byte, or 8 bits. XOR looks at the corresponding bits in each value and creates a new value. If the two bits in the values were different, the output will have a 1 in that position. If the two were the same the output has a 0 in that position. USING EXCLUSIVE OR (XOR) IN CRYPTOGRAPHY XOR LOGIC 0 XOR 0=0 Same Bits 1 XOR 1 0 Same Bits 1 XOR 0=1 Different Bits 0 XOR 1=1 Different Bits OR Symbol ENCRYPT 0011010 1 Plaintext 11100011 secret Key 11010110 ciphertext DECRYPT 11010110 ciphertext 11100011 secret key 00110 10 1 Plaintext What makes XOR useful for basic encryption is that the operation is reversible. By using XOR again with the key and the encrypted data, we get the original as output. While this is very easy to implement, keep in mind that this is not very secure The XOR operator in C is used with the caret symbol Use it like you would a plus sign, with one operator on each side of it. It only works on ints and chars. Your program must Ask the user for the name of the file to encrypt/decrypt Ask the user for the name of the file to save the encrypted/decrypted file to . Ask the user for the key to use Encrypt/Decrypt the file by reading it one character at a time, using XOR on that character with the next character in the key, and then writing that to the output file o For example, if the key was "hello", the first character is XOR'd with 'h', the second with 'e', and so on, with the key repeating, so the 6th will also be XOR'd with 'h o You will need to use the binary file modes

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!