+ 2

# Solving Problems

Wrote a snake game that saves the highscore to a txt file. anyone can change that.. well, not anymore. before it writes the highscore to the save file it runs it thru an algorithm and stores a security number with it. when highscore info is loaded it runs the highscore from the file thru the algorithm and checks it againts the number that was stored with it when saved. to change the highscore in the file you also have to change the security number

16th Feb 2017, 6:54 PM
LordHill
3 Respuestas
0
I know, you probably don't care, but since my wife and kids don't care either, I like telling people when I do things.
16th Feb 2017, 6:55 PM
LordHill
0
So, in other words, you created a cryptographic hash function. Sounds good, but it is sufficiently randomized? I'll use the classic "Alice and Bob" for this scenario. Let's say Alice and Bob are two people who download your snake game. Alice and Bob both play the game, and they get the same high score. Is the hash (the security number) the same for the both of them? If so, then you still have a problem, because if Alice gets a higher score than Bob, Bob could get both the score and the hash, put them into his own text file, and start up the program again with Alice's high score. Yeah, cryptography is tough like that. You could get around it by creating a text file somewhere else on the user's computer, putting a random number in it, and using the hash function with that number as a key.
16th Feb 2017, 7:48 PM