对于的关键代码如下:
Private Sub btn_ok_Click(ByVal sender As Object, ByVal e As EventArgs)
If (Me.textBox_Pass.Text = "") Then
MessageBox.Show("请输入密码!")
Else
Dim array As Char() = Me.textBox_Pass.Text.Replace(".", "-").Replace("7", "t").Replace("4", "a").Replace("1", "I").Replace("0", "o").Replace("O", "0").ToCharArray
Array.Reverse(array)
Dim s As New String(array)
s.ToUpper
Dim chArray2 As Char() = Convert.ToBase64String(Encoding.GetEncoding("UTF-8").GetBytes(s)).ToCharArray
Array.Reverse(chArray2)
Dim str2 As New String(chArray2)
Dim str3 As New String(Convert.ToBase64String(Encoding.GetEncoding("UTF-8").GetBytes(str2)).ToCharArray)
If (str3 = "PTBpVGxSM1lqTWtVaE4yU0pOM1J2Qnph") Then
MessageBox.Show("密码正确!密码就是Key!", "成功")
Else
MessageBox.Show("密码错误!", "失败")
End If
End If
End Sub
下面我们分析一下代码:
If (Me.textBox_Pass.Text = "") Then
MessageBox.Show("请输入密码!")
Else
为空则提示错误
Dim array As Char() = Me.textBox_Pass.Text.Replace(".", "-").Replace("7", "t").Replace("4", "a").Replace("1", "I").Replace("0", "o").Replace("O", "0").ToCharArray
Dim chArray2 As Char() = Convert.ToBase64String(Encoding.GetEncoding("UTF-8").GetBytes(s)).ToCharArray
Array.Reverse(chArray2)
Dim str2 As New String(chArray2)
Dim str3 As New String(Convert.ToBase64String(Encoding.GetEncoding("UTF-8").GetBytes(str2)).ToCharArray)
If (str3 = "PTBpVGxSM1lqTWtVaE4yU0pOM1J2Qnph") Then
MessageBox.Show("密码正确!密码就是Key!", "成功")
Else
MessageBox.Show("密码错误!", "失败")
End If
End If