Does somebody know where may I find some info about generating serials numbers?
I basically want, given a username, to generate a serial number for it. Then into my application I want to check if the username / serial combo is correct.
..there is exactly what you searching for in code archives...anyway, here is code I have and its working fine..
; KeyGen
; This is a key generator for any blitzy thing you want
; include it in your main programs to unlock bits of code.
; The usage is pretty straight forward, key$ = keygen("Name or whatever")
; So you'll need to keep a version for yourself for sending keys to people!
name$ = "jkasdhdfakjdhfakjsdhakjdhajkdhasjkdhjfhcbnmzxcb msefbjhz"
key$ = keygen(name)
Print name
Print key
WaitKey
Function keygen$(name$)
; change v$ to as many or few random or unrandom letters, numbers, characters whatever
; this is what the key is going to be made out of
; You can have duplicates all over the place if you want, it's up to you!
; This is one part that will make your keys unique to other people using this program
; e.g. v$="I1D9U0AJ5PFWIN1TR3EKLWZID42HU7KL8S6LTBN9VMCXOF6T46GY3JHIE9T7VTLFDEQ3Y38P"
v$="I1D9U0AJ5PFWIN1TR3EKLWZID42HU7KL8S6LTBN9VMCXOF6T46GY3JHIE9T7VTLFDEQ3Y38P"
tname$ = name$
; make name longer if necessary
; again adjust this to make your keys unique
namel = 20
Repeat
If Len(tname) <= namel
temp$ = ""
For n = 1 To Len(tname)
temp = temp + Chr(Asc(Mid(tname, n, 1)) + 1)
Next
tname = tname + temp
EndIf
Until Len(tname) > namel
; this bit makes sure that you don't get any obvious repetitions over the 20 character key
For n = 5 To 100 Step 5
If Len(tname) = n Then tname = tname + "~"
Next
; create encrypt string
encrypt$ = ""
For n = 0 To 19
encrypt = encrypt + Chr(1)
Next
ee = 1
; over load encrypt 30 times
; change this to make your keys unique further
For l = 1 To 30
For n = 1 To Len(tname)
a = Asc(Mid(tname, n, 1))
a = a - 32
temp$ = ""
For nn = 1 To 20
tl = Asc(Mid(encrypt, nn, 1))
If nn = ee Then temp = temp + Chr(tl + a Mod 256)Else temp = temp + Chr(tl)
Next
encrypt = temp
ee = ee + 1
If ee = 20 Then ee = 1
Next
Next
; suck out the key
encrypted$ = ""
For ee = 1 To 20
e = Asc(Mid(encrypt, ee, 1))Mod Len(v)
If e = 0 Then e = 1
encrypted = encrypted + Mid(v, e, 1)
Next
; format the key with -'s
encrypted = Mid(encrypted, 1, 5) + "-" + Mid(encrypted, 6, 5) + "-" + Mid(encrypted, 11, 5) + "-" + Mid(encrypted, 16, 5)
; return the key
Return encrypted
End Function
Just for fun, I changed v$ to "ABC" and the serial key didn't have any C's in it. Here is my fix for this:
' suck out the key
encrypted$ = ""
For ee = 1 To 20
e = Asc(Mid(encrypt, ee, 1)) Mod (Len(v)+1) ' bugfix
If e = 0 Then e = 1
encrypted = encrypted + Mid(v, e, 1)
Next
(Not that it matters much if v$ is a really long string, but anyway...)
Commonly avoided characters in serial keys:
0O
5S
I1l
Rob, nice to see it also works in BMax although it creates a different serial key which I don't believe matters.
I didnt loop anything..I mention that its from somewhere in code archives...I didnt say its my code man..I just mention that I have it and using it..
... but the only 3 lines you took out were the owner lines. What made you do that?
'cause he's naughty! You Naughty Alien!
*sigh* I do it to clean up my code, *BUT*, i add the authors names next to the first line of a function, so i know who to credit :)
@Rob Farley:
Did you made that function based on a C++ function or something? If so, I would like to take a look at the original C++ function, as I there application I want to generate serial keys for is written in C++ :)
Jedive, no I made it all up using my own bizarre mind.
Jedive, Share*it offer a keygen SDK including the C/C++/Delphi/Java/VB source, it's worth a look if you've not already seen it ;)
KeyGen SDK:
https://secure.shareit.com/shareit/cp/download/KeyGen.zipKeyGen Faq:
https://secure.shareit.com/shareit/cp/download/KeyGenSDK.pdf[edit] Ah I've just realised, you'll need an account download them.