Hashing
Posted: Wed Jul 16, 2008 5:39 am
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?
Can anyone help?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
http://msdn.microsoft.com/en-us/library ... hcode.aspxThe 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.
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.