Source for UO:KR Hash Function

Diskussion und Informationen über UO:KR

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:

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.



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

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


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


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

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

I tried using different hashes on this string:

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.


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


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

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.

CHAR filepath[256] = "shaders/";
uint32_t hash1,hash2;
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.