Hashing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stoneferry
Forum Newbie
Posts: 9
Joined: Sat Feb 16, 2008 10:39 am

Hashing

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Hashing

Post 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
stoneferry
Forum Newbie
Posts: 9
Joined: Sat Feb 16, 2008 10:39 am

Re: Hashing

Post 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.
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Hashing

Post 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
Post Reply