I'm taking a beginner's VB/.NET class. Today we started working on a project involving a simple login form, e.g.:
Public Class Form1 Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click If txtUsername.Text.ToUpper <> "JOHNDOE" Then MessageBox.Show("Error: Username doesn't exist.") Exit Sub End If If txtPassword.Text <> "ThisIsMySecretPassword" Then MessageBox.Show("Error: Password doesn't match.") Exit Sub Else MessageBox.Show("You are now logged in. Now you can see all my secret data!") End If End Sub End Class
Of course, this has the obvious problem of "Hey, let's view the password by opening the .exe in Notepad!" So I was thinking of using the same method I use for web authentication, where the password the user types in is hashed and compared to the previously-hashed form of the correct PW. The thing is, I don't know how to do that.
Looking at MSDN, apparently a class does exist. However, I'm still new at this language and don't understand how to implement it. Could someone provide an example?