Imports System
Imports System.IO
Imports System.Text
Imports System.Security
Imports System.Security.Cryptography
Public Class frmSingle
Public Function MD5(ByVal Word) As String
Dim Bytes() As Byte = ASCIIEncoding.ASCII.GetBytes(Word)
Dim md5h As New MD5CryptoServiceProvider
Dim Byt() As Byte = md5h.ComputeHash(Bytes)
Dim i As Integer = (Byt.Length * 2 + (Byt.Length / 8))
Dim StrBuild As StringBuilder = New StringBuilder(i)
Dim i2 As Integer
For i2 = 0 To Byt.Length - 1
StrBuild.Append(BitConverter.ToString(Byt, i2, 1))
Next i2
Return StrBuild.ToString().TrimEnd(New Char() {" "c}).ToLower
End Function
Private Sub frmSingle_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
End
End Sub
Private Sub cmdcontrolla_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcontrolla.Click
If Len(txthash.Text) = 0 Then
MessageBox.Show("Inserire un hash da controllare!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
If MD5(txtword.Text) = txthash.Text Then
MessageBox.Show("L'hash " & txthash.Text & " corrisponde a " & txtword.Text, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show(txtword.Text & " non corrisponde all'hash " & txthash.Text, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
End Sub
End Class