2

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.

2
  • 4
    Do a Caesar cipher you just need to modify each character by a fixed amount.... Commented Jun 6, 2014 at 17:51
  • 1
    Monoalphabetic ciphers, like the Caesar/additive cipher suggested by jsantander, are both very simple and easily broken. To add a little to the challenge, you might consider an affine cipher or Vigenere cipher. These are all very quick to implement. Commented Jun 6, 2014 at 18:09

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

For your requirement you can use the string encryption offered by antispy C/C++ Obfuscation Library for all platforms.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.