Page 1 of 1

Hashing

Posted: Wed Jul 16, 2008 5:39 am
by stoneferry
Hi, I'm trying to find out what method the VB .NET GetHashCode() function uses with the view of using the same hashing method in PHP.

Can anyone help?

Re: Hashing

Posted: Wed Jul 16, 2008 10:48 am
by Benjamin
I love the part in bold.
The default implementation of the GetHashCode method does not guarantee unique return values for different objects. Furthermore, the .NET Framework does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of the .NET Framework. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.
http://msdn.microsoft.com/en-us/library ... hcode.aspx

Re: Hashing

Posted: Thu Jul 17, 2008 1:16 am
by stoneferry
Thanks for the response, what does all of that actually mean? Does it mean I'm unable to create a hash in PHP?


The GetHashCode() function supposedly uses the 'Zobel/Ramakrishna' method.

Re: Hashing

Posted: Thu Jul 17, 2008 1:30 am
by omniuni
I believe what is means is....

Code: Select all

 
While it's supposed to use the 'Zobel/Ramakrishna' method to produce a hash, it isn't implemented quite properly. However it is done, it is done the same in all the .NET stuff, so it will work fine internally. Don't however, expect to be able to reproduce the same hashes on other systems, because, as stated before, the buggy implementation yields somewhat unique results, even if it doesn't produce unique hashes.
.NET makes me slightly nauseous.

-OmniUni