Dim dbsalt As String ' a value from the salt field in the User table record is assigned here
Dim hash() As Byte
Dim password As String
Dim saltpassword As String
Dim saltpasswordbyte() As Byte
Dim mdencrypt As MessageDigest
Dim bc As ByteConverter
saltpassword = txtPassword.Text & dbsalt 'This is the combination of txtPassword from the form and the salt value from the db
saltpasswordbyte = saltpassword.GetBytes("UTF8") ' convert to bytes for the byteconverter
hash = mdencrypt.GetMessageDigest(saltpasswordbyte, "SHA-512") ' hash the byte value with SHA-512
password = bc.HexFromBytes(hash) ' convert the hashed byte value to hex and store in password string