Sign in to follow this  
Followers 0
James

Serial Key Generater

12 posts in this topic

#1 ·  Posted (edited)

Hey,

I know this is really simple etc, but if you want to sell your program, and want to have a special key with their name on etc, then this is the way to do it.

The name is Encrypted in this case using the key: "HGA45$90" to encypt the name.

Here is the code,

#cs
    Name: Program Registration
    Author: James Brooks
#ce

#include <GuiConstants.au3>
#include <String.au3>

Global $AccsKey = "HGA45$90"

$GUI = GUICreate("Program Registration", 397, 249, -1, -1)
$RegistrationGroup = GUICtrlCreateGroup("&Registration", 8, 8, 377, 113)
$NameLabel = GUICtrlCreateLabel("Name:", 16, 32, 35, 17)
$SerialLabel = GUICtrlCreateLabel("Serial:", 16, 96, 33, 17)
$RegName = GUICtrlCreateInput("", 56, 24, 313, 21)
$SerialKeyReg = GUICtrlCreateInput("", 56, 88, 313, 21)
$GenerateKey = GUICtrlCreateButton("&Generate Serial", 144, 48, 81, 33, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$InputForm = GUICtrlCreateGroup("&Register Program", 8, 128, 377, 113)
$NameInputLabel = GUICtrlCreateLabel("Name:", 16, 152, 35, 17)
$RegNameInput = GUICtrlCreateInput("", 56, 144, 313, 21)
$SerialLab = GUICtrlCreateLabel("Serial:", 16, 176, 33, 17)
$Serial = GUICtrlCreateInput("", 56, 168, 313, 21)
$Register = GUICtrlCreateButton("&Register", 296, 200, 73, 33, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GenerateKey
            Generate($RegName)
        Case $Register
            Register($RegNameInput)
    EndSwitch
WEnd

Func Generate($Name)
    $ReadName = GuiCtrlRead($Name)
    $Encrypt = _StringEncrypt(1, $ReadName, $AccsKey)
    GuiCtrlSetData($SerialKeyReg, $Encrypt)
EndFunc

Func Register($io_Name)
    $RegisterName = GuiCtrlRead($io_Name)
    $SerialRead = GuiCtrlRead($Serial)
    $Decrypt = _StringEncrypt(0, $SerialRead, $AccsKey)
    If $Registername = $Decrypt Then 
        MsgBox(4096, "Continue", "Congrats")
    Else
        MsgBox(16, "Error", "Incorrect serial key!")
    EndIf
EndFunc

You obviously would need to make the key longer and store in the registry somewhere, but this just shows you a basic way of making the keys.

I know it not greatly useful, but I used it when I sold someone a program they wanted.

Check out the new real-time encryption, with the abillity to define your own encryption key here!

Thanks,

James

Edit: Removed useless include.

Edit: Changed topic title.

Edited by NeoTroniX

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Update

Real-time encryption and define your own encyption key:

#include <GUIConstants.au3>
#include <String.au3>

#Compiler_Icon=infoicon.ico

Opt("TrayIconHide", 1)

Local $oldStr

$GUI = GUICreate("Serial Key Generator", 303, 146, -1, -1)
GUISetBkColor(0x339DD2)
$NameLabel = GUICtrlCreateLabel("Name:", 8, 12, 42, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Name = GUICtrlCreateInput("", 48, 8, 249, 21)
$SerialLabel = GUICtrlCreateLabel("Serial:", 8, 44, 33, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Serial = GUICtrlCreateInput("", 48, 40, 249, 21)
$KeyLabel = GuiCtrlCreateLabel("Key:", 8, 76, -1, -1)
GUICtrlSetColor(-1, 0xFFFFFF)
$Key = GuiCtrlCreateInput("a1b2c3", 48, 72, 249, 21)
$Copy = GuiCtrlCreateButton("&Copy Serial", 130, 100, 81, 33, 0)
$Exit = GUICtrlCreateButton("&Exit", 216, 100, 81, 33, 0)

GUISetState(@SW_SHOW)

While 1
    If @OSVersion = "WIN_95" or "WIN_98" or "WIN_ME" Then
        ProcessSetPriority($GUI, 2)
    ElseIf @OSVersion = "WIN_NT4" or "WIN_2000" or "WIN_XP" or "WIN_2003" or "WIN_VISTA" Then
        ProcessSetPriority($GUI, 4)
    EndIf
    $Str = GUICtrlRead($Name)
    If $Str <> $oldStr Then
        $EncryptedStr = _StringEncrypt(1, $Str, GuiCtrlRead($Key))
        If $EncryptedStr <> "" Then
            GUICtrlSetData($Serial, $EncryptedStr)
        Else
            GUICtrlSetData($Serial, "")
        EndIf
        $oldStr = $Str
    EndIf
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    If GUIGetMsg() = $Exit Then Exit
    If GUIGetMsg() = $Copy Then ClipPut(GuiCtrlRead($Serial))
WEnd

Func OnAutoItExit()
    MsgBox(4096, "Goodbye", "Thankyou for using the Password generator, created by James Brooks. 2007!")
EndFunc

http://www.autoitscript.com/fileman/users/public/Secure_ICT/RealEncryption.PNG

Please leave feedback!

Edited by NeoTroniX

Share this post


Link to post
Share on other sites

hii..the script look nice. OK, i'll try it later on and will leave my comment later.. TQ for sharing


AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites

Cool script, very useful! You can also add real-time to the key and not only to the name.


My Scripts: SimplePlayer 1.0 - A very simple music player. PCInfo 1.2 - A script that displays PC information.

Share this post


Link to post
Share on other sites

Well, lets say your script uses a name and serial key registration to allow the program to be come active, if you were to sell the program, and people buy it, but require a serial, you can take their name, and give them their serial.

Share this post


Link to post
Share on other sites

Brilliant. This is a great script although I dont understand the encryption methods.


My Programs:Rock Paper ScissorsMy UDFs:NONE

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

If you dont enter name or encryption key, it'll auto authorize it...

Edited by BackStabbed

tolle indicium

Share this post


Link to post
Share on other sites

Why not use something like..

$Randoms = _RandomText(4) & "-" & _RandomText(4) & "-" & _RandomText(4)
Msgbox(0,"",$Randoms)

Func _RandomText($N)
    If $N < 1 Then Return -1
    Local $COUNTER, $ALPHA, $RESULT
    For $COUNTER = 1 To $N
        If Random() < 0.5 Then
            $ALPHA = Chr(Random(Asc("A"), Asc("Z") + 1))
        Else
            $ALPHA = Chr(Random(Asc("a"), Asc("z") + 1))
        EndIf
        $RESULT = $RESULT & $ALPHA
    Next
    Return $RESULT
EndFunc  ;==>_RandomText

I forget who wrote this function, it was found somewhere on the forums.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Why not use something like..

$Randoms = _RandomText(4) & "-" & _RandomText(4) & "-" & _RandomText(4)
Msgbox(0,"",$Randoms)

Func _RandomText($N)
    If $N < 1 Then Return -1
    Local $COUNTER, $ALPHA, $RESULT
    For $COUNTER = 1 To $N
        If Random() < 0.5 Then
            $ALPHA = Chr(Random(Asc("A"), Asc("Z") + 1))
        Else
            $ALPHA = Chr(Random(Asc("a"), Asc("z") + 1))
        EndIf
        $RESULT = $RESULT & $ALPHA
    Next
    Return $RESULT
EndFunc  ;==>_RandomText

I forget who wrote this function, it was found somewhere on the forums.

Kurt

How do you check if the code is true?

With random serial you must give it at user, but how does the program verify the validate?


A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0