I was inspired to write a quick bank hash function for people to use.
Just a quick note on usage. Call the HashValues function, pass in the bank you have open and the name of the KEY you will be using to store the hash value in the bank. Then put the value you get back in the KEY that is reserved for the hash value. To test if the bank is valid simply check to see if the computed hash value of the bank is the same as the hash value stored in the bank.
UPDATES: Made unit hash stronger, it has also been tested so it should work for anyone who wishes to use it to protect their banks from tampering (NOTE: not 100%, you get around this by looking at how the hash is calculated and hashing the new values yourself)
The has can probably be better, if anyone wants to help contribute to this you are more than welcome to.
TODO:
-Make string hashing stronger.
-Figure out how to do any sort of hashing with text (any ideas anyone?)
-Enhance unit hashing to cover all important attributes (partially done)
Attachments:
Post has been edited 3 time(s), last time on Nov 1 2010, 7:35 pm by Temp.
None.
Quick, more detailed instructions, also OP was updated with an updated library:
Data->Library->Import Library (the one you downloaded)
Then you can use the functions included in the library. The only important one is HashValues (anyone know how to make a function private to a library?)
Then when you are about to save your bank call the HashValues function and pass in the bank and a string which represents the key that you will store the hash value in the bank.
Put the value you get back from the function in the bank in any section where the key is the same string you passed into the function.
NOTE: The key must be unique globally in the bank (that is in all sections)
Then to check whether the bank is valid open the bank and run the HashValues function the same way again and then compare the value you get back from the function with the value you already stored in the bank under that unique key.
None.
Unit hashing is now much stronger, there are still probably values im missing (for items and such). Added a test map to the OP. To use simply open the test map, hit Init bank and the Save bank. You can run a check now and it will say same. Exit SC and open the bank (Called TestBank) and edit some values. Reopen the map and hit check, should say different.
None.
Have you tested this on multiplayer mode? Because I already know of experience that Banks can work when testing the map locally, but not when published publically.
None.
I haven't, probably should. Don't see it changing the hashing part though.
None.
>be faceless void >mfw I have no face
Lemme get this straight, I can use this with a key to encrypt bank info, correct? If I just want to encrypt bank info, no unit info or anything, will it do that for me?
Red classic.
"In short, their absurdities are so extreme that it is painful even to quote them."