I have a small C++ program that contains a "secret" string that must be hard to find in the object code, e.g.,
#include <iostream>
int main() {
std::string a = "super-secret-string-that-must-be-hard-to-discover";
std::cout << a;
return 0;
}
When compiling this on Unix and running strings on the a.out
, one gets around 150 lines with
[...]
u+UH
super-secret-string-that-must-be-hard-to-discover
basic_string::_M_construct null not valid
[...]
Well, that was easy.
Is it possible to harden the above code against such decompilation, perhaps as a preprocessing step or as a compiler option?