Question
Write a C++ program that encrypts a string of text with a maximum size of 132 characters by XORing a hex 0AC to each character
Write a C++ program that encrypts a string of text with a maximum size of 132 characters by XORing a hex 0AC to each character in the input buffer. The program will display the input buffer, the encrypt buffer and the decrypted buffer. Your program will display each char of the buffer as a hex character. You will use an InputBuffer of size 133, a EncryptedBuffer of size 133, and a ClearBuffer of size 133.
No global variables can be used. You will create your buffers in main().
You will use a function called InputData to input the data to the inputBuffer. You will pass the InputBuffer to this function where the input data will be input. You will make sure to display the contents of the InputBuffer.
You will also have a function called Encrypt where you will pass the input Buffer and the EncryptedBuffer. You will have a variable named key of type short that will have the value 0xAC Note: The xor operator is ^. You will then XOR each character in the InputBuffer and then copy that character to the EncryptedBuffer. Then the function will display the contents of the EncryptedBuffer. A header file is required and will be named global.h. Make sure to add in guarding into this file.
You will have another function called DeCrypt where you will pass the EncryptedBuffer and the ClearBuffer. You will XOR the each character in the EncrytedBuffer and copy the result into the ClearBuffer. This function will then display the contents of the ClearBuffer. The program will loop until the user is asked to run again with a y or quit with a q
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started