Option Explicit
Private Sub Form_Load()
Call MsgBox(VerifyKey("0000000000003")) '// <-- Valid Key
End
End Sub
' mov eax, 3
' mov esi, ecx
' mov ebp, edx
' xor ecx, ecx
'Top:
' movsx edx, byte ptr [ecx+esi]
' sub edx, 30h
' lea edi, [eax+eax]
' xor edx, edi
' add eax, edx
' inc ecx
' cmp ecx, 0Ch
' jl short Top
' xor edx, edx
' mov ecx, 0Ah
' div ecx
'
' movsx eax, byte ptr [esi+0Ch]
' movsx edx, dl
' add edx, 30h
' cmp eax, edx
' jnz bottom
' mov eax, 1
' retn 8
'bottom:
' xor eax, eax
' retn 8
Public Function VerifyKey(Key As String) As Boolean
Dim eax&, esi&, ecx&, ebp&, edx&, edi&, dl&
Let eax = 3
Let esi = 1 '// Key pointer
'Let ebp = edx '// No clue what this does, but its not needed
Let ecx = ecx Xor ecx '// Key position
Top:
Let edx = Asc(Mid(Key, (ecx + esi), 1))
Let edx = edx - &H30 '// Move from the ASCII value of the number, to the numerical value
Let edi = eax + eax
Let edx = edx Xor edi
Let eax = eax + edx
Let ecx = ecx + 1
If Not ecx = &HC Then GoTo Top
Let edx = 0
Let edx = &HA
Let dl = eax Mod edx
Let eax = Asc(Mid(Key, (esi + &HC), 1))
Let edx = dl
Let edx = edx + &H30
If Not eax = edx Then GoTo Bottom
Let VerifyKey = True: Exit Function
Bottom:
Let VerifyKey = False: Exit Function
End Function
Fixed. I left the broken code so people can have a good laugh.
EDIT -
It was still always returning true. This time I actually did fix it.