[Help] Making a keygen
I've made a large part of a keygen by converting the asm code of a crackme to vb, but I still have one problem. When the input string is converted to hex, it doesn't output the right serial because the asm crackme converted ascii and not strings. So I'm wondering how to make namechar ascii in the following code:
Please help with this =P. Nearly done, just need that ascii representation and the correct key will be generated.
Code:
Imports System.Text
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("This keygen was made by Shadow!")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text <> "" And TextBox1.Text.Count >= 5 Then
Dim fullname = TextBox1.Text
Dim fullnamecalc = TextBox1.Text
Dim namechar
Dim calcser
Dim namechardec As Integer
For i = 0 To fullname.Count - 1
namechar = fullnamecalc.Substring(0, 1)
fullnamecalc = fullnamecalc.Substring(1, fullnamecalc.Count - 1)
namechar = StringToHex(namechar)
namechardec = Convert.ToInt64(namechar, 16)
If IsEven(namechardec) = True Then
namechar = Val(namechar) + &HF
namechar = Val(namechar) + &H2
ElseIf IsEven(namechardec) = False Then
namechar = Val(namechar) - &HF
namechar = Val(namechar) + &H2
End If
calcser = calcser & namechar
Next
TextBox2.Text = calcser
Else
MsgBox("You must enter at least 5 characters!")
End If
End Sub
Public Function StringToHex(ByVal str As String) As String
Dim bytes() As Byte
Dim ret As String
bytes = Encoding.Default.GetBytes(str)
For Each b As Byte In bytes
ret &= b.ToString("x").ToUpper & " "
Next
Return ret.Trim()
End Function
Public Function IsEven(ByVal i) As Boolean
If ((i Mod 2) = 0) Then
Return True
Else
Return False
End If
End Function
End Class