.GetHashCode

mike55

Contributor
Joined
Mar 26, 2004
Messages
727
Location
Ireland
I am running a project in vs.net 2003 and in 2005, I am using the .gethashcode() to generate the hash value of my password which will be used in a comparison with the value stored in a database. However .gethashcode() from 2005 generates a totally different value from that of 2003. Has the hashing function been changed? and if so, how do I go about getting back the old hash values?

Mike55.
 
The .GetHashCode inherited from System.Object isn't a cryptographically sound hashing routine and shouldn't be relied on for passwords etc. it is mainly used to determine the uniqueness of an object within the running application and most definitely not between executions and versions.

If you are wanting to use this for passwords or similar you should really be looking at one of the hashing classes under System.Security.Cryptography such as MD5 (although this has recently be found to have limitations) or one of the SHA variants.
 
Last edited:
PlausiblyDamp said:
The .GetHashCode inherited from System.Object isn't a cryptographically sound hashing routine and shouldn't be relied on for passwords etc. it is mainly used to determine the uniqueness of an object within the running application and most definately not between executions and versions.

If you are wanting to use this for passwords or similar you should really be looking at one of the hashing classes under System.Security.Cryptography such as MD5 (although this has recently be found to have limitations) or or one of the SHA variants.

Hi PlausiblyDamp,

I have taken your suggestion regarding the SHA1, however it brings me back to the same problem as yesterday, in that once I have the hashed value in a byte array, how can I store that in a string? I have used (new unicoding).getString(byte() name).

Mike55.
 
Back
Top