Hi this is my basic registration scheme that makes a Hex code from a username it only basic cos it my first try, Just thought it maybe handy to someone comments and suggestions welcome.
vbnet Code:
Public Class Form1
Private Function CheckCode(ByVal Username As String, ByVal Code As String) As Boolean
Dim sn As String = MakeCode(Username)
Return sn.Equals(Code)
End Function
Private Function MakeCode(ByVal Username As String) As String
Dim MagicSeed As Integer = &H1B1F
Dim sn As Integer = 0
For Each c As Char In Username
'Plus sn and MagicSeed times username char value.
sn += MagicSeed * Asc(c)
Next
'Return hex or you may want to just return a number.
Return Hex(sn)
End Function
Private Sub cmdDemo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDemo.Click
Dim code As String = MakeCode("John")
'Show generated code.
MessageBox.Show("Serial =" & code, "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Test 1
MessageBox.Show("Serial Match = " & CheckCode("John", "2A4551"), "Demo",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
End Class