|
利用MD5实现RegWrite加密及RegRead验证 加以密码对话框的使用 因为是初学者 所以请大大帮忙修改一下 看能不能缩减代码
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <md5.au3>
$mm1 = md5("admin")
$mm2 = RegWrite("HKLM\Software\set", "password","reg_sz",$mm1)
$Form2 = GUICreate("密码对话框", 251, 100, -1, -1)
GUISetIcon("D:\autoit3\Aut2Exe\Icons\tc.ico")
$PasswordEdit = GUICtrlCreateInput("", 8, 32, 233, 21, $ES_PASSWORD)
GUICtrlSetLimit(-1, 18)
$ButtonOk = GUICtrlCreateButton("确定(&O)", 86, 64, 75, 25, 0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$ButtonCancel = GUICtrlCreateButton("取消(&C)", 167, 64, 75, 25, 0)
$EnterPassLabel = GUICtrlCreateLabel("请输入密码:", 8, 12, 76, 17)
$mm = RegRead("HKLM\Software\set", "password")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCancel
Exit
Case $ButtonOk
$psw = GUICtrlRead($PasswordEdit)
If md5($psw) <> $mm Then
MsgBox(16,"密码错误",'请重新输入密码')
ControlSetText("","",$PasswordEdit,"")
EndIf
If md5($psw) = $mm Then
ExitLoop
EndIf
EndSwitch
WEnd
MsgBox(64,"通过","验证通过")
[ 本帖最后由 gs008970 于 2008-10-28 14:23 编辑 ] |
|