Random CRC works "kinda"
Ok so I been browsing the web and asking for help and I got some help and this is what we have come up with. The goal to write random bytes in my DLL file, each time i load it. However it only randomizes the DLL crc 1 time.
The .exe file is the one that reads out the DLL bytes and then writes over certain area randomly, but I dunno why it is only random crc 1 time..
Heres the code.
in the DLL.
Been trying to figure it out for days now, no luck.
Again first run of the exe. the dll randomizes the crc, 2nd time and 3rd and so on, nothing even though its still writing..
There are at least two problems here. First of all, string literals are pointers, so SIZEOF_STAMP(UNIQUE_STAMP_BEGIN) == sizeof( char* ). Second, a PRNG is deterministic - seed it with some number N and it will generate the same values every time. In this case, you're attempting to initialize it with itself, meaning N never changes.
PRNG you mean the rand() ?
Originally Posted by Sebastiani
What 'N' are you talking about.
>> PRNG you mean the rand() ?
Yes, as in psuedo-random number generator.
>> What 'N' are you talking about.
The number you pass to srand(). For example, this program will always generate the same numbers (when compiled with the same rand() implementation):
In other words, you're initializing rand with rand, so the result is the same every time. Does that make sense?
int main( void )
srand( 3114 );
for( ;; )
printf( "%d\n", rand( ) );
Ah I see, so how can I create purely random outcomes then.
Strictly speaking, PRNG's don't generate random sequences (hence "psuedo"). Anyway, the standard approach is to use time(NULL) as the seed.
Works perfect! Awesome man, I thought the problem was way more complicated. After my week of hell you fixed it with that.
I dont know if you can answer this or not, but for some reason when my file is 600 kb , this works, but if I pack / encrypt it so people cannot break my software protection, this fails, and gives a runtime error at the assert line.
After packing its nearly 1.6 mb.
If its packed does it become unreadable? I mean, so we wont find our signature string.
Well naturally, if it's encrypted it's going to have to be decoded before the check can be made.
Right, so I guess the only way to go is without encrypting it.
I don't actually get how the copy protection works, though. Could you elaborate on that?
What do you mean the copy protection, do you mean the software protection to prevent people from sending the application out to their friends and their friends from being able to use it?
If thats what you mean, the protection just checks for a computers hardware information as the program is locked to certain computers, and the information is hardcoded into the application. I know it sucks, but for my skill level theres not much of a choice.
And thats why I need to encrypt, so people cant easily get these HWIDs and then use it to fake their own in a patched copy.
Right, the software protection scheme you're going for.
Ok, I see. Well at the very least you could use a simple XOR encryption (with 0xff, perhaps) scheme to make the data less obvious. Another (but slightly more extreme) approach would be to issue a unique ID (and embed that value) in the application, and require that the user connects to a network, sending the ID and HW info, at which point you could simply compare the information with what you have in a database. It's not bulletproof, either, but a bit more robust, anyway (if not somewhat intrusive).