samedi 29 août 2015

Compile time string encryption using constexpr

I want to have a compile-time string encryption, such that I could write in my code:

const auto encryptedInvalidLicense = ENCRYPT("Invalid license");
std::cout << encryptedInvalidLicense.decrypt() << std::endl; // outputs "Invalid license"

and the string "Invalid license" wont appear in the binaries. Pre-builds might be the answer, but I'm looking for a pure c++ constexpr solution to this problem, and that it will be supported by VS2015.

Any suggestions?


  1. I've already looked into Compile-time string encryption, which doesn't provide a constexpr solution to the problem.

  2. I've also looked into http://ift.tt/1fN60YE . Though it's a constexpr solution, VS2015 still adds the strings plain text to the binaries.

Aucun commentaire:

Enregistrer un commentaire