I am considering changing the method by which we encrypt passwords to use a one-way hash, not to encrypt. I considered using a simple "GetHashCode" in the password string, but MS warns that this feature may change in the future and is different from 32-bit and 64-bit OS. I don’t want the result to ever be different, as this will cause all the passwords in the database to no longer match when I have the entered value (for example, when we all go to .NET 9.0 or something else )
So, does SHA1 Hash fix the problem? For example, if I use this C # code:
var data = System.Text.Encoding.ASCII.GetBytes(value); data = System.Security.Cryptography.SHA1.Create().ComputeHash(data); return Convert.ToBase64String(data);
will value always and always be the same result? I'm not too worried about a collision in space, this is big, but is there any other reason to consider a wider hash? Thanks in advance!
source share