Compile-time string encryption

前端 未结 8 2173
悲哀的现实
悲哀的现实 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;
    }
    

提交回复
热议问题