visual studio 2008 - Encrypt strings in pure C in order to hide them in the executable -
i trying avoid literal strings appearing in executable. want put string encrypted in executable , decrypt , use @ runtime. read bit how hide string in binary code? , http://bytes.com/topic/c/answers/222096-hiding-string-compiled-code, not want.
could done using macros? example, can declare wide char string using
wchar_t str[] = l"value"
or
wchar_t *str = l"value"
and magical l
convert chars widechars. possible create magical l
make encrypted strings? e.g:
enc"value"
for moment defining encrypted strings macros:
#define sample_string "ftnurd eru etrth" /*random chars imitating encryption*/
and passing them normal function like
char *decstr(char *data)
is there easier method this?
i using windows xp sp3 visual c++ 2008 express.
why not create encryption , decryption function? write like
char *hidden_password = my_encrypt("passw0rd"); puts(hidden_pasword); // "acud5ttei23w8d" // ... char *real_password = my_decrypt("acud5ttei23w8d"); puts(real_password); // "passw0rd"
however, it's not idea store hard-wired text strings in executable if contain sensitive data. also, don't reinvent wheel - before rolling own encryption method, try established, high-quality, cryptographically secure libraries openssl.
Comments
Post a Comment