I am trying to avoid literal strings from appearing in the executable. I want to put a string encrypted in the executable and then decrypt and use it at runtime. I read a bit into How to hide a string in binary code? and http://bytes.com/topic/c/answers/222096-hiding-string-compiled-code, but this is not exactly what I want.
Could it be done using macros? For example, I can declare a wide char string using
wchar_t str[] = L"value"
or
wchar_t *str = L"value"
and magical L
will convert chars to widechars. Is it possible to create another magical L
like this to make encrypted strings? E.g:
ENC"value"
For the moment I am defining already encrypted strings as macros:
#define SAMPLE_STRING "ftnurd eru etrth" /*Random chars for imitating encryption*/
and passing them to a normal function like
char *decstr(char *data)
Is there an easier method to do this?
I am using Windows XP SP3 with Visual C++ 2008 Express.