Cogito, ergo sum.
Join Date: Feb 2008 Posts: 1,821
GPoints: 1,004 Rep Power: 9 | Key Gen ( For your own AU3 programs) Code: #include <String.au3>
#include <GUIConstants.au3>
Global $Key , $Strength , $CryptKey
GUICreate("Key Gen...", 200, 75)
$Name = GUICtrlCreateInput("Name", 0, 0, 200, 20)
$Email = GUICtrlCreateInput("Email@hotmail.com", 0, 25, 200, 20)
$Gen = GUICtrlCreateButton("Gen Key", 0, 50, 75, 25, 0)
$Rev = GUICtrlCreateButton("Reverse Key", 80 , 50, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Gen
If GUICtrlRead($Name) = "" Or GUICtrlRead($Email) = "" Then
MsgBox(0 , "Error." , "your name and email are required.")
ElseIf StringIsDigit(GUICtrlRead($Name)) Then
MsgBox(0 , "Error." , "no numbers allowed in your name.")
ElseIf Not StringInStr(GUICtrlRead($Email) , "@" , 1) Then
MsgBox(0 , "Error." , "your email is incorrect it should look something like this" & @CRLF & "" & @CRLF & "test@hotmail.com")
Else
GUICtrlSetState($Name , $GUI_DISABLE)
GUICtrlSetState($Email , $GUI_DISABLE)
GUICtrlSetState($Gen , $GUI_DISABLE)
GUICtrlSetData($Name ,StringLower(GUICtrlRead($Name)))
GUICtrlSetData($Email ,StringLower(GUICtrlRead($Email)))
_Gen(GUICtrlRead($Name) , GUICtrlRead($Email))
GUICtrlSetState($Name , $GUI_ENABLE)
GUICtrlSetState($Email , $GUI_ENABLE)
GUICtrlSetState($Gen , $GUI_ENABLE)
MsgBox(0 , "" , "This is your key" & @CRLF & @CRLF & $CryptKey)
EndIf
;Case $Rev
; If GUICtrlRead($Name) = "" Or GUICtrlRead($Email) = "" Then
; MsgBox(0 , "Error." , "your name and email are required.")
; ElseIf StringIsDigit(GUICtrlRead($Name)) Then
; MsgBox(0 , "Error." , "no numbers allowed in your name.")
; ElseIf Not StringInStr(GUICtrlRead($Email) , "@hotmail.com" , 1) Then
; MsgBox(0 , "Error." , "your email is incorrect it should look something like this" & @CRLF & "" & @CRLF & "test@hotmail.com")
; Else
; GUICtrlSetState($Name , $GUI_ENABLE)
; GUICtrlSetState($Email , $GUI_ENABLE)
; GUICtrlSetState($Gen , $GUI_ENABLE)
; GUICtrlSetData($Name ,StringLower(GUICtrlRead($Name)))
; GUICtrlSetData($Email ,StringLower(GUICtrlRead($Email)))
; _Rev(GUICtrlRead($Name) , GUICtrlRead($Email))
; GUICtrlSetState($Name , $GUI_ENABLE)
; GUICtrlSetState($Email , $GUI_ENABLE)
; GUICtrlSetState($Gen , $GUI_ENABLE)
; MsgBox(0 , "" , "This is your key" & @CRLF & @CRLF & $CryptKey)
; EndIf
EndSwitch
WEnd
Func _Gen($Key , $Strength)
$Reverse = _StringReverse($Key)
$Hex = _StringToHex($Reverse)
$Bin = StringToBinary($Hex)
$CryptKey = _StringEncrypt(1 , $Bin , $Strength , 1)
Return $CryptKey
EndFunc
;Func _Rev($Key , $Strength)
;;;
;;;;
;EndFunc In case you decide to make it so you need a code to access your programs.
This is for AUTOIT only.
__________________ |