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.
[03:36 pm]
Oh_Man -- a program called mapstats I think it's on here to DL
[02:39 pm]
GGmano -- so theres a limit on total triggers on around 80k?
[02:38 pm]
GGmano -- thanks for info anyway
[02:38 pm]
GGmano -- how did you found that out ohh man?
[02:15 pm]
Oh_Man -- mapstats says 80k triggers
[09:37 pm]
GGmano -- maybe its not about the size i guess since its now above 6000 and was saved
[09:05 pm]
GGmano -- just seems like 6000kb is an obstacle not sure
[09:05 pm]
GGmano -- idk it could also be about the map size its like above 6k kb map wont be saved,, 6000kb of triggers no sounds im aware sounds can go beyond that size
[08:51 pm]
GGmano -- heres link for the new release http://www.staredit.net/topic/18475/#1
[08:51 pm]
GGmano -- i now released it after deleting triggers 3 times sadly
Please log in to shout.


Members Online: O)FaRTy1billion[MM], KrayZee