What is XOR? XOR is basically abbreviation of "exclusive or", which is a logical port.
XOR algorithms are symmetrical, and very simple. In theory, a xor crypted message is easy
to crack, but cracking a xor encrypted data can be made significantly harder by using
at least as long key as the message.

Interesting about xor encryption is the fact that the algorithm can be used both ways, so
the same algorithm that was used to encrypt the message with a specific key, can be also used
to also decrypt the encrypted message.

More:
https://en.wikipedia.org/wiki/Exclusive_or
https://en.wikipedia.org/wiki/XOR_cipher

Code:
#include <iostream>
#include <string>

using namespace std;

//this will be our xor encryption/decryption function

string XOR(string data, char key[])
{
    string xorstring = data; //initialize new variable for our xordata
    for (int i = 0; i < xorstring.size(); i++) { //for loop for scrambling bits in the string
        xorstring[i] = data[i] ^ key[i % (sizeof(key) / sizeof(char))]; //scrambling the string/descrambling it
    }
    return xorstring;
}
// XOR FUNCTION WORKS BOTH WAYS!
 int main()
{
    char key[3] = { 'K', 'E', 'Y' };
    string encrypt =  XOR("virtual", key);
    cout << encrypt;
        string decrypt =  XOR("=,+t>$5", key); //same string encrypted as above
    cout << decrypt;
    getchar();
    return 0;
}
video associated with this tutorial: