Since things didn't work out between me and mbedtls, here are the basic encryption algorithms.
Diff: xor.cpp
- Revision:
- 0:65a36a7b25d0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xor.cpp Sat Nov 10 20:11:01 2018 +0000 @@ -0,0 +1,23 @@ +#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; +}