Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++ how to make exe unreadable


ghost's Avatar
0 0

Hi, i´ve problem with c++, every when user opens the compiled *.exe, he can (with good text editor) see all text strings, and without disassembler!! how can i make *.exe that cant be readable (text strings) by text editor or in a disassembler?? thanks in advance for help, i´m trying to program something as rooting challenge, i have 50% done, but if the strings are readable… you know :(


ghost's Avatar
0 0

Encrypt the strings and decrypt them when you need to use them. It won't stop someone who is out to reverse engineer the solution, but it should stop someone from opening it in a text editor and flipping through it easily enough.

Very basic solution, please feel free to post a better one


ghost's Avatar
0 0

and can you tell me how can i basically encrypt/decrypt them? i´ve tryed xor… but what is your idea ??


ghost's Avatar
0 0

You could store the strings as individual characters, then join them up when you need to use them.

If you want to encrypt them, XOR should be fine to stop someone from casually flipping through the exe in notepad.


ghost's Avatar
0 0

thanks :D EDIT: but… when i use XOR as encryption, i need to declare somewhere a key, and somewhere the words, too, i use example from older thread:

#include <string>

void xorPassword(std::string &oS, std::string &oK)
{
int i = -1;
while(++i<oS.length()) oS[i] ^= oK[i%oK.length()];
}

int main()
{
std::string myPass = "daniel";
std::string myKey = "key";

xorPassword(myPass, myKey);

std::cout << myPass << std::endl;

std::cin.get();
return 0;
}```
so when i´ll try to get input of value myPass, i´ve get the daniel, encrypted in XOR, but theres another daniel, used when declaring the string myPass... and this can be visible... so the strings still can be visible :( can someone give me an example how to a XOR for a lots of strings?? thanks

ghost's Avatar
0 0

XOR the string, then store it in the executable as hex digits or something. Then when you want to use the string, change it back to the XOR'd string, and un-XOR it.


ghost's Avatar
0 0

ok, but to XOR the string, i will need to declare it in some value firs, e.g. string toXOR = "blahblahblah"; and this string can be visible…


ghost's Avatar
0 0

Nooooo, you XOR the string using a seperate program, and store it as hex in your program. Then take it out of hex when you want to use it, and de-XOR it.


ghost's Avatar
0 0

ok, but how can i cooperate "XORing program" with my own program, because the xor is unreadable characters, i probably need to store it in some string, and this string then give to my app… but how i get this work?? then i will HEX the XORed string (in my prog) and when i will need to use it, i will convert it from hex to xor and dexor it, i understand you but i dont know how to "transport" the xored string from separate app to my app :(


ghost's Avatar
0 0

Make the app that does the XOR'ing output the result directly as hex, then you can use that in your prog.


ghost's Avatar
0 0

ok, thanks, finally i understand it :D


ghost's Avatar
0 0

i´m finishing my converting app, but i have, i hope last, problem. i have done the encrypting to the xor, app asks me to enter string, and this string is encrypted into the xor, but how can i convert encrypted xor value, currently saved in string xor; to hex? xor is unreadable characters, arrows, smileys etc. etc. but not some alphabetical characters… is there any code that can convert string xor; into the hex? thanks