Source for UO:KR Hash Function

Diskussion und Informationen über UO:KR
Antworten
Nachricht
Autor
Murzelpurzel

Source for UO:KR Hash Function

#1 Beitrag von Murzelpurzel » 22 Jul 2008 17:46

I did some googling today on the UO:KR hash function that is used in the UOP filename mangling.

For those who are interested in this, I found the original source code used by the UO developers online. They simply copied a public domain hash algorithm, that can be found here:

http://burtleburtle.net/bob/c/lookup3.c

Since the compiler of the current UO:KR executable does not optimize unused functions away, you can even see the other functions found in that file inside the UO executable...

The used function name is "hashlittle2" with HASH_LITTLE_ENDIAN undefined.

cu,
Murzel

SiENcE

#2 Beitrag von SiENcE » 29 Jul 2008 00:30

whats the hash algo? md5, sha1, sha256 ... ?

Murzelpurzel

#3 Beitrag von Murzelpurzel » 10 Aug 2008 01:10

SiENcE hat geschrieben:whats the hash algo? md5, sha1, sha256 ... ?
As I said above they don't use a cryptographic hash algorithm but one of the algorithms in the linked source file above.

rootbender

#4 Beitrag von rootbender » 25 Sep 2008 06:21

Someone please tell me, how exactly is Unpacker verifying the filename string?

http://img210.imageshack.us/img210/4468/testfc6.png

I tried using different hashes on this string:
shaders/GameTerrain_Onscreen.inc.psh

http://textop.us/Hashing/Adler-32

But, they don't match hashes given in file:
hash1: 0014F105
hash2: 055D70D3
unkn: 397A7CC3

I try hashlittle2() function too, but it doesn't give me those values.

Kons

#5 Beitrag von Kons » 25 Sep 2008 11:17


rootbender

#6 Beitrag von rootbender » 25 Sep 2008 18:29

Hi!
I tried that too, but it still doesn't match.

Here's what I get:

Code: Alles auswählen

 hashlittle2: 055CEE19, 57C7FE76  (inital seeds: 0x00000000, 0x00000000) 
HashmeGently: 055CEE19, 57C7FE76 
    MYP hash: 0014F105, 055D70D3 
Aren't HashmeGently and hashlittle2 the same functions anyway? HashmeGently looks like a dumped assembly version
of hashlittle2. They both return two 32-bit values, and they both have that 12step case. HashmeGently packs
it into a 64-bit value, but it's still two distinct values.

Both functions return the same hash values for me, but they don't match the hash values from the MYP file.

// TEST
CHAR filepath[256] = "shaders/GameTerrain_Onscreen.inc.psh";
uint32_t hash1,hash2;
hash1=0;
hash2=0;
hashlittle2( (void *)filepath, strlen(filepath), &hash1, &hash2 );

btw, there's something wrong with the

Code: Alles auswählen

 statements on this board.  It's replacing colons with %u3a in my text.

Antworten