Question: You can create a simple form of encryption using the xor Boolean operator. For example, if you want to encrypt the letter 'A': (Without the
You can create a simple form of encryption using the xor Boolean operator. For example, if you want to encrypt the letter 'A': (Without the use of Arrays)
- Choose another letter as a "key", say 'X'
- Encrypt 'A' with the xor function: encrypted = 'A' xor 'X'
- Now you can decrypt by xor'ing your encrypted value with 'X' again: decrypted = encrypted xor 'X'
Write a C++ program that meets the following requirements:
- Asks the user for the name of an input file and a "key" character
- Encrypts each character in the file using the entered key and the xor function. (Note: The program should handle all standard alphanumeric characters.)
- Your program should save the results of the encryption into a new file with the same base name, but with a ".xor" file extension.
- Program should also provide an option to decrypt a given file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
