Storing a SHA512 Password Hash in Database

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2009-12-01T21:02:44Z Indexed on 2010/04/14 13:23 UTC
Read the original article Hit count: 448

Filed under:
|
|
|
|

In my ASP.NET web app I'm hashing my user passwords with SHA512.

Despite much SO'ing and Googling I'm unclear how I should be storing them in the database (SQL2005) - the code below shows the basics of how I'm creating the hash as a string and I'm currently inserting it into the database into a Char(88) column as that seems to be the length created consistently

Is holding it as a String the best way to do it, if so will it always be 88 chars on a SHA512 (as I have seen some bizarre stuff on Google)?

 Dim byteInput As Byte() = Encoding.UTF8.GetBytes(sSalt & sInput)
 Dim hash As HashAlgorithm = New SHA512Managed()
 Dim sInsertToDatabase As String =  Convert.ToBase64String(hash.ComputeHash(byteInput))

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sha512