Reputation: 19727
I want to obfuscate some string data stored locally on iOS/Android device. Something similar to a high score in a game. My goal is to thwart only the laziest people, so encrypting the data really isn't necessary. What does the C++ Standard Library provide that can help?
I looked briefly at cryptopp.com and libtomcrypt but I think they're overkill for what I want to achieve.
Upvotes: 2
Views: 1561
Reputation: 149
For your requirement you can use the string encryption offered by antispy C/C++ Obfuscation Library for all platforms.
Upvotes: 1
Reputation: 50053
Assuming the string to be "encrypted" is not terribly long, you can use a XOR cipher.
Generate a random string with the same length as your input string and xor your input with it to encrypt and decrypt.
void xor_strings (string& message, const string& key) {
for (size_t i = 0; i < message.size(); ++i)
message[i] ^= key[i];
}
If you save both strings in your file, it will just contain two random strings.
Upvotes: 1