本帖最后由 basc 于 2018-12-30 11:24 编辑
#include <Crypt.au3>
Global $key = "basc" ;;加密码
Global $str = "192.168.0.162"
_Crypt_Startup()
$hKey = _Crypt_DeriveKey($key, $CALG_AES_256)
$s = _Crypt_EncryptData($str, $hKey, $CALG_USERKEY)
ConsoleWrite("Encrypted: " & $s & @CRLF)
MsgBox(4096,"", $s)
$str = _Crypt_DecryptData($s, $hKey, $CALG_USERKEY)
$213 = BinaryToString($str)
MsgBox(4096," ", $213)
这加密的结果和我以下复制到内存的加密的结果不同
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <Crypt.au3>
#include <Clipboard.au3>
#include <GuiMenu.au3>
#Region ### START Koda GUI section ### Form=C:\Users\basc\Desktop\gui.kxf
$Form1 = GUICreate("Form1", 394, 172, 261, 318)
$Input1 = GUICtrlCreateInput("输入需要加密的内容", 32, 16, 169, 21)
$Button1 = GUICtrlCreateButton("加密", 208, 16, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Global $str = GUICtrlRead($Input1)
MsgBox(4096,"",$str)
Global $key = "basc" ;;加密码
_Crypt_Startup()
$hKey = _Crypt_DeriveKey($key, $CALG_AES_256)
$s = _Crypt_EncryptData($str, $hKey, $CALG_USERKEY)
_ClipBoard_SetData($s)
MsgBox(4096," ",$s)
EndSwitch
WEnd |
|