Compile-time string encryption

前端 未结 8 2280
悲哀的现实
悲哀的现实 2020-12-28 17:08

I don\'t want reverse-engineers to read the plain-text of hardcoded strings in my application. The trivial solution for this is using a simple XOR-Encryption. The problem is

相关标签:
8条回答
  • 2020-12-28 17:55

    This is a late answer, but I'm sure there's a better solution.

    Plese refer to the accepted answer here.

    Basically, it shows how to use the ADVobfuscator lib to obfuscate strings as simple as:

    #include "MetaString.h"
    
    using namespace std;
    using namespace andrivet::ADVobfuscator;
    
    void Example()
    {
        /* Example 1 */
    
        // here, the string is compiled in an obfuscated form, and
        // it's only deobfuscated at runtime, at the very moment of its use
        cout << OBFUSCATED("Now you see me") << endl;
    
        /* Example 2 */
    
        // here, we store the obfuscated string into an object to
        // deobfuscate whenever we need to
        auto narrator = DEF_OBFUSCATED("Tyler Durden");
    
        // note: although the function is named `decrypt()`, it's still deobfuscation
        cout << narrator.decrypt() << endl;
    }
    
    0 讨论(0)
  • 2020-12-28 17:56

    This blog provides a solution for compile time string hashing in C++. I guess the principle is the same. Unfortunately You have to create one Makro for each string length.

    0 讨论(0)
提交回复
热议问题