About security, I think it's useless to implement a complex system... You can crack it anyways, except the way exploiter described, but I think this would be an overkill... :-\Trust me, Laurent suggestion is the right way to go. As a professional web developer I use this approach alot across different API's. Actually it's the most common way to secure a payment gateway from being hijacked.
AlexAUT
Trust me, Laurent suggestion is the right way to go. As a professional web developer I use this approach alot across different API's. Actually it's the most common way to secure a payment gateway from being hijacked.Web development and "binary" development are two very different things and need a completely different approach in regards to security measurements.
Before one can crack your system, one will need to know your secret key. And for type of HASH, go with a SHA-2 hash and then you'll be good to go :-)
But you can expand this approach alot. You could reverse the whole HASH and so on to make it more difficult for one to understand what you're doing in your code.Obfuscation is a good thing and while it won't increase the actual security, it will still prevent low-skilled people from "cracking" things.
As for securing for replay do some IP checking and time checking.Time checking against what? You know one could simply execute a replay attack from the same IP. ;)
For the private/secret key, I would make a function that manipulates the key before it'll be used and delete the manipulated key from memory right after. I know this will not be totally secure, but it will be harder for the hacker to pull the key out.That's a possible obfuscation and since you'll actually have to know the de/encryption algorithm for the saved key, you're forcing "hackers" to look at the code/asm. With a debugger and some asm knowledge this is however still rather easy to figure out - thing of all the serial keys algorithm that have been reverse engineered. But yes, for a simple game, this serves well enough I'd say.
Time checking against what?Well make some kind og algorithm that checks if the request is actually possible for one to do. If the same score request comes two times in a row. Thats suspicious, but actually possible. But the same score within 1 minute, well thats should not be possible (of course this depends on what game it is). I would use sessions to control this.