6-1-2009 11:30:59
Imports VB6 = Microsoft.VisualBasic
Public Class Form1
Inherits System.Windows.Forms.Form
Function KeyGen(ByVal username As String, ByVal var1 As Object, ByVal var2 As Object, ByVal var3 As Object, ByVal var4 As Object) As String
Dim v1, v2, v3, v4
Dim p1, p2, p3, p4
Dim length
length = Len(username)
v1 = Asc(VB6.Left(username, 1))
v2 = Asc(VB6.Right(username, 1))
v3 = Asc(VB6.Left(username, (length / 2)))
v4 = Asc(VB6.Right(username, (length / 2)))
p1 = VB6.Right(Hex(v1 * v2 + (v3 + v4) * var1 * 100), 5)
p2 = VB6.Left(Hex(v2 * v4 + (v1 + v2) * var2 * 100), 5)
p3 = VB6.Right(Hex(v1 * v3 + (v2 + v4) * var3 * 100), 5)
p4 = VB6.Left(Hex(v2 * v4 + (v3 + v1) * var4 * 100), 5)
keygen = p1 + "-" + p2 + "-" + p3 + "-" + p4
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
TextBox2.Text = KeyGen(TextBox1.Text, 100, 200, 300, 400)
Catch
MsgBox("Error Number " & Err.Number & vbCrLf & Err.Description)
TextBox1.Text = TextBox1.Text + "1"
End Try
End Sub
End Class