• Welcome to Valhalla Legends Archive.
 

Password Hashing Woes

Started by Barabajagal, July 29, 2007, 04:22 PM

Previous topic - Next topic

Barabajagal

For some odd reason, Double Password Hashing seems to break...
Here's what's going on: I was having issues with my password hasher dll (one I'm writing), and so I decided to do a little comparing with BNCSutil. I tried randomly generated Server and Client tokens, and passwords of different lengths and contents. I came to the conclusion that I'm missing something. Whenever either the client or server token has double-0s at the in it (in hex display), it breaks everything.
For example, I use the password "zzz", the client token 0x2D339300 and the server token 0x5184A580. When I use a makeshift double-hasher (meaning, I hash the password with bncsutil, get dwords of the two tokens, and then hash them all together), I get the result of EEA03A4D5A1D2694576F4A5860998D6B80C64615 (hex). When I just use BNCSutil's double-hasher, I get 8E9CECF64B0DC38C3DC8637760615DDECDF7D03C. When I use my own (makeshift and function yield same result), I get AF02EF7352F19BA3AC2FAF3C6DC65929D8FA0A2C. As I recall, double-hashing is done something like..
Hash = BrokenSHA(CreateDWORD(ClientToken) & CreateDWORD(ServerToken) & BrokenSHA(strPassword))
Right? Or did I leave something out somewhere?

Edit: I've noticed if the double 00's in a token are at the front, only the double-hash function in BNCSutil is different. Is it not a DWORD that's created for the tokens hashing?

Edit #2: Apparently having those 00's in either token effectively sets that token to 0 when using BNCSutil's single hash when the 00's are anywhere but the beginning.

Edit #3: Well, it seems my Broken SHA1 function doesn't deal with null characters correctly.

Final Edit: Conclusion - I accidentally made a GetDWORD function in my DLL have a null terminated string, which caused my Broken SHA1 function to break. BNCSutil trims nulls for hashing just the password (single hash and the first hash of double). Problem solved. Thanks Blake for helping me out on AIM.

Yegg

Don't put the strike through lines in the part(s) of your post that no longer matter to you personally. Other's can still learn from them. It can still be read, but I'm sure others would agree with me when I say that it's a bitch reading it with all those white lines through every single word.

Barabajagal

My apologies. I figured if people really wanted to read it and didn't like the lines, they'd just copy and paste into notepad.

Yegg

Copying and pasting into notepad is just extra work. Not that I'm super lazy or anything, but I should just be able to read it right off the site. I went to the thread because I figured I might learn something, the lines seriously got in the way.

Barabajagal

Well it's fixed now, so go ahead and attempt your learning ;)