At least here is my keygen in VB 2010.
The SHA function must be modified as chessgog101 says.
Quote:
Option Strict On
Imports System.Text
Imports System.Security.Cryptography
Public Class frmKeygen
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtName.TextChanged
If txtName.Text.Length < 1 Then
txtSerial.Text = "Name must have at least 1 char "
Return
End If
Dim sirsha As String = EncryptSHA256Managed(txtName.Text.Trim).ToUpper
Dim ebx As Integer = 0
Dim eax As Integer = 0
Dim ecx As Integer = 0
sirsha = sirsha.Replace(" ", "")
For i = 0 To sirsha.Length - 1
Dim caracter As Integer = CInt("&H" + (sirsha.Substring(i, 2)))
i = i + 1
ebx = caracter
ebx = ebx * ecx
ebx = ebx * ebx
ebx = ebx + &H50
eax = eax + ebx
ecx = ecx + 1
Next
eax = eax Xor &H12345678
txtSerial.Text = eax.ToString
End Sub
Public Function EncryptSHA256Managed(ByVal ClearString As String) As String
Dim uEncode As New ASCIIEncoding()
Dim bytClearString() As Byte = uEncode.GetBytes(ClearString)
Dim sha As New _
System.Security.Cryptography.SHA256Managed()
Dim hash() As Byte = sha.ComputeHash(bytClearString)
Dim sBuilder As New StringBuilder
For Each b As Byte In hash
sBuilder.AppendFormat("{0:x2} ", b)
Next
Return sBuilder.ToString()
End Function
End Class
|