mgreen84
05-19-2010, 09:48 PM
Hi all,
I'm using the following code below on my sign page to my app, because the user passwords are stored as its Hash(MD5) value in the database. So I need for when the user types their password on the login page to be converted to its Hash(MD5) value so it can match the value in the database. The code I'm using below to address this issue doesn't seem to be doing that, can anyone tell me why? or provide a better way?
'Performs the login
Public Overridable Sub Login(ByVal bRedirectOnSuccess As Boolean)
Dim password As String = Me.Password.Text
Dim mhash As HashAlgorithm = New MD5CryptoServiceProvider()
Dim bytValue() As Byte = System.Text.Encoding.UTF8.GetBytes(password)
Dim bytHash() As Byte = mhash.ComputeHash(bytValue)
mhash.Clear()
Me.Password.Text = Convert.ToBase64String((bytHash)
Me.Login(bRedirectOnSuccess)
End Sub
I'm using the following code below on my sign page to my app, because the user passwords are stored as its Hash(MD5) value in the database. So I need for when the user types their password on the login page to be converted to its Hash(MD5) value so it can match the value in the database. The code I'm using below to address this issue doesn't seem to be doing that, can anyone tell me why? or provide a better way?
'Performs the login
Public Overridable Sub Login(ByVal bRedirectOnSuccess As Boolean)
Dim password As String = Me.Password.Text
Dim mhash As HashAlgorithm = New MD5CryptoServiceProvider()
Dim bytValue() As Byte = System.Text.Encoding.UTF8.GetBytes(password)
Dim bytHash() As Byte = mhash.ComputeHash(bytValue)
mhash.Clear()
Me.Password.Text = Convert.ToBase64String((bytHash)
Me.Login(bRedirectOnSuccess)
End Sub