mike55 Posted February 1, 2006 Posted February 1, 2006 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. Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
Administrators PlausiblyDamp Posted February 1, 2006 Administrators Posted February 1, 2006 (edited) 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. Edited March 10, 2007 by PlausiblyDamp Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mike55 Posted February 1, 2006 Author Posted February 1, 2006 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. Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
Administrators PlausiblyDamp Posted February 1, 2006 Administrators Posted February 1, 2006 Use the code I posted yesterday with Convert.ToBase64String / .FromBase64String to handle a string representation of the data. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.