Since things didn't work out between me and mbedtls, here are the basic encryption algorithms.

xor.cpp

Committer:
priyanshu_varshney
Date:
2018-11-10
Revision:
0:65a36a7b25d0

File content as of revision 0:65a36a7b25d0:

#include <iostream>

using namespace std;

string encryptDecrypt(string toEncrypt) {
    char key[3] = {'K', 'C', 'Q'}; 
    string output = toEncrypt;

    for (int i = 0; i < toEncrypt.size(); i++)
        output[i] = toEncrypt[i] ^ key[i % (sizeof(key) / sizeof(char))];

    return output;
}
int main(int argc, const char * argv[])
{
    string encrypted = encryptDecrypt("Priyanshu");
    cout << "Encrypted:" << encrypted << "\n";

    string decrypted = encryptDecrypt(encrypted);
    cout << "Decrypted:" << decrypted << "\n";

    return 0;
}