C++: How to encrypt strings at compile time?

前端 未结 10 1259
北荒
北荒 2020-12-18 21:40

I want to hide some strings in my .exe so people can\'t simply just open the .exe and look at all the strings there. I don\'t care about the strength of the encrypting metho

10条回答
  •  借酒劲吻你
    2020-12-18 22:33

    No matter the details of your solution it will involve encrypting the strings using some encryption program.

    You might write a script to encrypt literals in your source code.

    Or for a Windows exe you might encrypt literals in an [.rc] file, embedding the strings as a string table resource in the exe.

    But probably the best solution is to not try any hiding.

    When Microsoft tried the XOR hiding trick on the Windows code that arbitrarily warned about non-Microsoft DOS-es being unreliable and incompatible with this and that, it just backfired on them. Of course the idea of saying bad things about competitors and bundling that bad-saying with Windows was a Really Stupid Idea in the first place. But, trying to hide the code was what made it into a public embarrassment: nobody had really noticed the warnings the code produced, but when people discovered "encrypted" code, naturally their curiosity was engaged, they just had to find out what it was, and write articles about it.

    Cheers & hth.,

提交回复
热议问题