What makes xor useful for basic encryption is that


Assignment: 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.

1477_XOR-Class.jpg

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.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: What makes xor useful for basic encryption is that
Reference No:- TGS02362531

Expected delivery within 24 Hours