MD5 problem in vb 2010

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
12 posts Page 2 of 2
Contributors
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: MD5 problem in vb 2010
mandai
I got it working, though I have no idea what it does.
Code: Select all
        Dim str2 As String = "GeenIDCreations"
        Dim str1 As String = "31330172046F07770A760D65106F1365166519301C2E1F2E22680265036F057306660874096D0B760C690E640F6F1163126E14761572177418721A321B301D381E31203221312336243030"

        For i As Integer = 1 To Len(str1) / 2
            Dim temp As String = Mid(str1, (2 * i - 1), 2)
            Dim temp1 As Char = Chr("&H" & temp)
        Next i

        Dim temp2 As String = ""
        Dim var As String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        Dim L As Integer = var.Length

        For i = 1 To 19
            Dim S As String = Mid(var, Rnd() * (L - 1) + 1, 1)
            If i >= S.Length Then
                Exit For
            End If
            temp2 += S(i)
        Next i

        Dim myMD5 As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()

        Dim temp3 As String = Mid(temp2, 1, 4) & Mid(temp2, 5, 4) & Mid(temp2, 9, 4) & Mid(temp2, 13, 16)
        Dim toBeComputed(temp3.Length + str2.Length - 2) As Byte
        For i As Integer = 0 To temp3.Length - 1
            toBeComputed(i) = Asc(temp3(i))
        Next
        For i As Integer = temp3.Length To str2.Length + temp3.Length - 2
            toBeComputed(i) = Asc(str2(i))
        Next

        Dim temp4 As Byte() = myMD5.ComputeHash(toBeComputed)

        Dim temp6 As String = ""

        For i As Integer = 0 To temp4.Length / 2
            Dim temp5 As String = Mid(temp4(0), 2 * L - 1, 1) 'what index are you after out of temp4? i guess 0.
            temp6 += temp5

        Next i

        TextBox1.Text = temp3 & Mid(temp6, 1, 4) & Mid(temp6, 5, 4) & Mid(temp6, 9, 4) & str2
User avatar
geenID
New Member
New Member
Posts: 15
Joined: Mon Dec 21, 2009 5:56 pm

Re: MD5 problem in vb 2010
geenID
sorry, my pc was crashed for a while...

There are no errors, but it is not working, in textbox1.text = GeenidCreations
and that is fault
12 posts Page 2 of 2
Return to “Coding Help & Support”