James Posted July 19, 2007 Posted July 19, 2007 (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,expandcollapse popup#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 EndFuncYou 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,JamesEdit: Removed useless include.Edit: Changed topic title. Edited July 20, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
James Posted July 19, 2007 Author Posted July 19, 2007 (edited) UpdateReal-time encryption and define your own encyption key:expandcollapse popup#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!") EndFunchttp://www.autoitscript.com/fileman/users/public/Secure_ICT/RealEncryption.PNGPlease leave feedback! Edited July 19, 2007 by NeoTroniX Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
slayerz Posted July 20, 2007 Posted July 20, 2007 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]
James Posted July 20, 2007 Author Posted July 20, 2007 Thanks slayerz Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
ToKicoBrothers Posted July 20, 2007 Posted July 20, 2007 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.
James Posted July 21, 2007 Author Posted July 21, 2007 You can also add real-time to the key and not only to the name.Yeah, I am doing that aswell. I have just been slightly busy. I was making the key real-time with the serial and name. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
jvanegmond Posted July 22, 2007 Posted July 22, 2007 How would you recommend using this in a script? github.com/jvanegmond
James Posted July 23, 2007 Author Posted July 23, 2007 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. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Bradness Posted August 4, 2007 Posted August 4, 2007 Brilliant. This is a great script although I dont understand the encryption methods. My Programs:Rock Paper ScissorsMy UDFs:NONE
Glyph Posted August 4, 2007 Posted August 4, 2007 (edited) If you dont enter name or encryption key, it'll auto authorize it... Edited August 4, 2007 by BackStabbed tolle indicium
_Kurt Posted August 5, 2007 Posted August 5, 2007 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..
Fabry Posted August 5, 2007 Posted August 5, 2007 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. KurtHow 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]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now