HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hash Functions

09-24-2007, 04:19 AM#1
Ammorth
I have put the finishing touches on a personal save-code system. It includes a hash check which is supposed to prevent modified codes from working. Now, so far as I understand, a hash just does calculations to all digits of a code, and then displays a hash. Doing a hash on the code after, and compare the old with the new sees if the code is still correct.

Now, some hash functions are better than others. For example. adding all the digits together is bad, since it cannot account for extra 0 digits or the placement of the digits. I want to know what the best method would be to insure optimal protection, or does it not really matter?
09-24-2007, 04:36 AM#2
PipeDream
Indeed it doesn't really matter. I suggest using a commutative code, as letting people scramble their names is a real convenience. Cheaters can always spoof.

If you really want to, there are a number of practical ways to get it in JASS:
  • Division
  • One of Marsaglia's arithmetic PRNGs
  • Warcraft's Get/SetRandomSeed
09-24-2007, 05:30 AM#3
Ammorth
Quote:
Originally Posted by PipeDream
Indeed it doesn't really matter. I suggest using a commutative code, as letting people scramble their names is a real convenience. Cheaters can always spoof.

If you really want to, there are a number of practical ways to get it in JASS:
  • Division
  • One of Marsaglia's arithmetic PRNGs
  • Warcraft's Get/SetRandomSeed

I'm already using Warcraft's RandomSeed method (thanks to viewing your code) and some division. I'm also using prime numbers in the hash, since it is supposed to reduce the number of duplicate hashes that can be generated.

I'm also finishing a scrambler that generates random strings internally. Hopefully that will add a few more levels of protection to prevent codes from being exploited.