Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Security.Cryptography
- Imports System.Text
- Public Class Form1
- Dim password As String = "b521cdb4ba5a2e51d9068914f050486c" ' md5 of "xdemo"
- Dim username As String = "bc7dc0884bd2ed66dc4197c686c1a400" 'md5 of "md5login"
- Function MD5Hash(ByVal strToHash As String) As String
- Dim md5Obj As New Security.Cryptography.MD5CryptoServiceProvider
- Dim bytes() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
- bytes = md5Obj.ComputeHash(bytes)
- Dim strResult As String = ""
- For Each b As Byte In bytes
- strResult += b.ToString("x2")
- Next
- Return strResult
- End Function
- Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
- Handles btnLogin.Click
- If username = MD5Hash(txtUser.Text) Then
- If password = MD5Hash(txtPass.Text) Then
- MsgBox("logged in")
- End If
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement