Staredit Network > Forums > SC2 Assistance > Topic: Bank Hashing Function
Bank Hashing Function
Oct 31 2010, 10:46 pm
By: Temp  

Oct 31 2010, 10:46 pm Temp Post #1



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:
hashTest.SC2Map
Hits: 0 Size: 188.17kb
BankHash.SC2Lib
Hits: 0 Size: 77.06kb

Post has been edited 3 time(s), last time on Nov 1 2010, 7:35 pm by Temp.



None.

Nov 1 2010, 1:44 pm Temp Post #2



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.

Nov 1 2010, 7:37 pm Temp Post #3



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.

Nov 2 2010, 1:10 am payne Post #4

:payne:

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.

Nov 2 2010, 2:37 am Temp Post #5



I haven't, probably should. Don't see it changing the hashing part though.



None.

Feb 11 2011, 7:52 pm Jack Post #6

>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."

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
Please log in to shout.


Members Online: Ultraviolet, Roy