Public Class Hash
Private Function ComputeHashValue(ByVal data() As Byte) As Byte()
Dim hashAlg As System.Security.Cryptography.SHA1 = System.Security.Cryptography.SHA1.Create()
Dim hashvalue() As Byte = hashAlg.ComputeHash(data)
Return hashvalue
End Function
Public Function HashPassword(ByVal password As String) As String
Dim encoder As System.Text.UTF8Encoding
Dim b() As Byte
encoder = New System.Text.UTF8Encoding
b = encoder.GetBytes(password)
b = ComputeHashValue(b)
Return Convert.ToBase64String(b)
End Function
End Class
No comments:
Post a Comment