Simple key generator and validator, use it as you will
REM Project: keygen
REM Created: 07/11/2011 19:03:19
REM
REM ***** Main Source File *****
REM
name as string
key as string
InName$ = "Ed 'edzup' Upton"
Key$ = KeyGen( InName$ )
Print InName$
Print Key$
print:print
Print "Validating key..."
if ValidateKey( InName$, Key$ )=1 then print "Key validated" else print "Key invalid"
wait key
end
Function ValidateKey( name$ as string, KeyCode$ as String )
` 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"
local v$ as string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
local tname$ as string
local temp$ as string
local name1 as integer
local returnString$ as string
local Key as integer
local Ok as integer
Ok = 0
temp$ = left$( name$, 21 )
for ee=1 to len( temp$ )
if mid$( temp$, ee ) >" "
tname$ = tname$ +mid$( temp$, ee )
else
tname$ = tname$ +chr$( ee +65 )
endif
next
`fill out string
if len( tname$ )<21
for ee=len( tname$ ) to 21
tname$ = tname$ +chr$( ee+65 )
next
endif
for ee=1 to len( tname$ )
Key = Key +asc( mid$( tname$, ee ) )
next
local value as integer
temp$ = ""
for nn=1 to len( tname$ )
value = asc( mid$( tname$, nn ) )
if value>0
if Key/Value<len( v$ )
temp$ = temp$ +Mid$( v$, Key /value );
else
temp$ = temp$ + "A"
endif
else
if nn<len( v$ )
temp$ = temp$ +mid$( v$, nn )
else
temp$ = temp$ +"A"
endif
endif
next
` format the key with -'s
for kp =1 to 5
returnString$ =returnString$ +Mid$( temp$, kp )
next
returnString$ = returnString$ +"-"
for kp =6 to 10
returnString$ =returnString$ +Mid$( temp$, kp )
next
returnString$ = returnString$ +"-"
for kp =11 to 15
returnString$ =returnString$ +Mid$( temp$, kp )
next
returnString$ = returnString$ +"-"
for kp =16 to 20
returnString$ =returnString$ +Mid$( temp$, kp )
next
` return the key
if returnString$ = KeyCode$
Ok=1
endif
EndFunction Ok
Function keygen( name$ as string )
` 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"
local v$ as string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
local tname$ as string
local temp$ as string
local name1 as integer
local returnString$ as string
local Key as integer
temp$ = left$( name$, 21 )
for ee=1 to len( temp$ )
if mid$( temp$, ee ) >" "
tname$ = tname$ +mid$( temp$, ee )
else
tname$ = tname$ +chr$( ee +65 )
endif
next
`fill out string
if len( tname$ )<21
for ee=len( tname$ ) to 21
tname$ = tname$ +chr$( ee+65)
next
endif
for ee=1 to len( tname$ )
Key = Key +asc( mid$( tname$, ee ) )
next
local value as integer
temp$ = ""
for nn=1 to len( tname$ )
value = asc( mid$( tname$, nn ) )
if value>0
if Key/Value<len( v$ )
temp$ = temp$ +Mid$( v$, Key /value );
else
temp$ = temp$ + "A"
endif
else
if nn<len( v$ )
temp$ = temp$ +mid$( v$, nn )
else
temp$ = temp$ +"A"
endif
endif
next
` format the key with -'s
for kp =1 to 5
returnString$ =returnString$ +Mid$( temp$, kp )
next
returnString$ = returnString$ +"-"
for kp =6 to 10
returnString$ =returnString$ +Mid$( temp$, kp )
next
returnString$ = returnString$ +"-"
for kp =11 to 15
returnString$ =returnString$ +Mid$( temp$, kp )
next
returnString$ = returnString$ +"-"
for kp =16 to 20
returnString$ =returnString$ +Mid$( temp$, kp )
next
` return the key
EndFunction returnString$
-EdzUp
Graveyard Dogs