1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| Public Class Form1
Dim UpperCase As String
Dim Lowercase As String
Dim Digits As String
Dim ObjCmd5 As New Cmd5
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ComboBox1.SelectedIndex = 0
End Sub
Private Sub TextBox4_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox4.TextChanged
Button2.Enabled = True
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim text As String = TextBox4.Text
If (TextBox4.Text <> "") Then
TextBox1.Text = ObjCmd5.CalcMd5(text)
Else
MessageBox.Show("Erreur : Le champ Mot doit être complété")
End If
End Sub
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.MaxLength = 32
Button1.Enabled = True
ComboBox1.Enabled = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Select ComboBox1.SelectedIndex
Case 1
UpperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Case 2
Lowercase = "abcdefghijklmnopqrstuvwxyz"
Case 3
Digits = "1234567890"
End Select
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
decrypterMD5()
End Sub
Private Sub decrypterMD5()
Dim text As String = TextBox1.Text
Dim alphabet As String = ComboBox1.SelectedIndex
Dim stopwatch As New Stopwatch
Dim maxi As String = 1
stopwatch.Start()
TextBox3.Text = ("" & 1)
If Not ObjCmd5.decryptMD5("", 1, alphabet, text) Then
Do
maxi += 1
stopwatch.Start()
TextBox3.Text = ("" & maxi)
Loop While Not ObjCmd5.decryptMD5("", maxi, alphabet, text)
End If
TextBox2.Text = ObjCmd5.RetourChaine
stopwatch.Stop()
Dim elapsedMilliseconds As Integer = CInt(stopwatch.ElapsedMilliseconds)
MessageBox.Show(("Trouvé en : " & CStr((elapsedMilliseconds * 0.001)) & " sec"))
End Sub
End Class |