Writing a simple hash function
Moderator: Cheaters
-
- Forum Staff
- Posts: 811
- Joined: January 1st, 2008, 12:58 am
Writing a simple hash function
I've always wondered this - how exactly do you hash a, lets say chat string..i could never figure this out
Wanna learn to hack maps? --> Guide
-
- The Flying Cow!
- Posts: 2196
- Joined: November 2nd, 2007, 10:34 pm
- Location: Melbourne
Re: Writing a simple hash function
There isn't one way... There are lots. But, I find, the most common way is to replace each character with another character.. So for example:
I want to hash "-gold", I could do:
Replace "-" with "d"
Replace "g" with "l"
Replace "o" with "0"
Replace "l" with "g"
Replace "d" with "-". And so the string "-gold" would be hashed (sort of.... That is nowhere near correct)
And it would turn out as "dl0g-" = "-gold"
But there are other more complicated ways, this is just the very basics.
I want to hash "-gold", I could do:
Replace "-" with "d"
Replace "g" with "l"
Replace "o" with "0"
Replace "l" with "g"
Replace "d" with "-". And so the string "-gold" would be hashed (sort of.... That is nowhere near correct)
And it would turn out as "dl0g-" = "-gold"
But there are other more complicated ways, this is just the very basics.
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
AutoCP3 now available for free!
-
- Forum Staff
- Posts: 811
- Joined: January 1st, 2008, 12:58 am
Re: Writing a simple hash function
Now i get it . ThxOzzapoo wrote:There isn't one way... There are lots. But, I find, the most common way is to replace each character with another character.. So for example:
I want to hash "-gold", I could do:
Replace "-" with "d"
Replace "g" with "l"
Replace "o" with "0"
Replace "l" with "g"
Replace "d" with "-". And so the string "-gold" would be hashed (sort of.... That is nowhere near correct)
And it would turn out as "dl0g-" = "-gold"
But there are other more complicated ways, this is just the very basics.
Wanna learn to hack maps? --> Guide
-
- Forum Staff
- Posts: 1400
- Joined: March 17th, 2008, 12:07 am
Re: Writing a simple hash function
He didn't ask what it is.storyyeller wrote:The purpose of a hash is to make it impossible to figure out codes solely from looking at the JASS code.
In that respect, the one posted above fails badly. But that was just an example, it's not meant for actual protection
The basic theory behind hashes is that they rely on a one way function: one that is easy to do, but near impossible to undo.
That way, when someone enters a chat string, the map calculates the hash value of the entered string (which is easy), and then compares it to the hashvalue of the code which you put into the map in advance.
If someone opens up your map and looks at the triggers, all they will see is the hash value of the code. If they want to find out the actual code, they have to undo the hash (which is near impossible).
You can try making up your own hash function. However, this runs the risk that the function you choose is actually not that hard to undo.
The best option is to use a publicly available hash function like SHA-1 or MD5. These are functions that have been widely published and analyzed for years. The brightest minds in the world have tried to break these and have not found a way yet. That's about as secure as you can get.
I'd suggest you try wikipedia or google to learn more.
Made by the late ILikeHacking
My quote from SKillER
Spoiler:
-
- Member
- Posts: 89
- Joined: January 20th, 2009, 12:39 pm
Re: Writing a simple hash function
With this in the .j file will be "dl0g-" and when you type it in the game "-gold" it will work?Ozzapoo wrote:There isn't one way... There are lots. But, I find, the most common way is to replace each character with another character.. So for example:
I want to hash "-gold", I could do:
Replace "-" with "d"
Replace "g" with "l"
Replace "o" with "0"
Replace "l" with "g"
Replace "d" with "-". And so the string "-gold" would be hashed (sort of.... That is nowhere near correct)
And it would turn out as "dl0g-" = "-gold"
But there are other more complicated ways, this is just the very basics.
LoL What was i Smoking when i talked to You?
-
- The Flying Cow!
- Posts: 2196
- Joined: November 2nd, 2007, 10:34 pm
- Location: Melbourne
Re: Writing a simple hash function
You're supposed to "decrypt" it first...
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
AutoCP3 now available for free!
-
- Member
- Posts: 89
- Joined: January 20th, 2009, 12:39 pm
Re: Writing a simple hash function
Do you have the time to make a toturial on how to "decrypt" or simply you can give me a link where its explained?
LoL What was i Smoking when i talked to You?
-
- Some Honorary Title
- Posts: 1713
- Joined: June 8th, 2007, 5:08 am
- Title: Angry Bird
-
- Forum Drunk
- Posts: 2899
- Joined: January 17th, 2007, 4:22 pm
- Has thanked: 1 time
- Been thanked: 1 time
Re: Writing a simple hash function
Hashes can't be used to encrypt jass code cause of their one way nature -.-
More like hiding the activator. And using md5/sha1 makes it easy to attack them, there are dozens of attacks against them.
I've used Whirlpool once I needed them, though I wouldn't lie my hand in the fire for this algorithm.
More like hiding the activator. And using md5/sha1 makes it easy to attack them, there are dozens of attacks against them.
I've used Whirlpool once I needed them, though I wouldn't lie my hand in the fire for this algorithm.
Don't pm me with Warcraft questions, this is a forum so just make a post!
In the world of thinking we are all immigrants. -Robert Nozick
-
- Senior Member
- Posts: 178
- Joined: February 15th, 2009, 9:08 pm
Re: Writing a simple hash function
If you hate hashes so much, just use digital signatures or something