Write yoXOR cipher is an extremely common data encryption algorithm. A basic Wi-Fi security
system uses a XOR cipher and a swap algorithm for encryption, the exact procedure is given
below:
Step Process Description Example
0 Input Given an original text input ABCDE
1 Reverse Reverse the order of the elements EDCBA
2 Swap Swap (key + 1)th and last element (if key = 0) ADCBE
3 XOR Apply bitwise XOR operation with key (if key = 6) GBEDC
Write a C++ program that encrypts and decrypts a text message using the above procedure with a 6-bit XOR key value of 39 (binary: 100111) and a 2-bit swap key value of 3 (swap 4th and last element). When it is completed, the program should ask the user to enter a text message, encrypts and decrypts it accordingly and then display the results of encryption and
decryption.
Note: step 1 (reverse) and step 2 (swap) can be applied using reverse and swap
functions, the procedure should be reversed for decryption.ur question here.