0
我有一個Login form
,我還沒有做任何關於hashing
的密碼,但我一直在閱讀有關散列,但它真的讓我困惑,並且不知道如何在我的代碼中爲登錄表單實現它。 代碼散列只見vb.net登錄表單的散列密碼
轉換回字節
hashOfBytes = Convert.FromBase64String(strHash)
**我的登錄表單代碼**
Using conn As New MySqlConnection("Server = localhost; Username= root; Password =; Database = forms")
Using cmd
With cmd
MsgBox("Connection Established")
.Connection = conn
.Parameters.Clear()
.CommandText = "SELECT * FROM users WHERE BINARY Username = @iUsername AND Password = @iPassword"
.Parameters.Add(New MySqlParameter("@iUsername", txtUser.Text))
.Parameters.Add(New MySqlParameter("@iPassword", txtPass.Text))
End With
Try
conn.Open()
dr = cmd.ExecuteReader()
Catch ex As MySqlException
MsgBox(ex.Message.ToString())
End Try
End Using
End Using
If dr.HasRows = 0 Then
MsgBox("Invalid user")
Conn.Close()
Else
Start.Show()
Conn.Close()
End If
End Sub