au3-加密解密工具
#NoTrayIcon#include <GUIConstants.au3>
$Form1 = GUICreate("好好学习", 392, 273, (@desktopwidth-392)/2, (@desktopheight-273)/2)
$Group1 = GUICtrlCreateGroup("", 0, 0, 391, 273)
$Edit1 = GUICtrlCreateEdit("", 8, 16, 375, 185, $WS_VSCROLL, $WS_EX_CLIENTEDGE)
$Checkbox1 = GUICtrlCreateCheckbox("", 31, 220, 17, 17)
$Button1 = GUICtrlCreateButton("加 密", 48, 216, 81, 25, $BS_FLAT)
GUICtrlSetTip(-1, "加密")
GUICtrlSetCursor ($Button1, 0)
$Input1 = GuiCtrlCreateInput(1, 90, 245, 40, 20, 0x2001)
$UpDownLevel = GUICtrlSetLimit(GuiCtrlCreateUpDown($Input1),100,1)
GUICtrlCreateLabel("加密次数", 33, 249, 56, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("解 密", 160, 216, 81, 25, $BS_FLAT)
GUICtrlSetTip(-1, "解密")
GUICtrlSetCursor ($Button2, 0)
$Button3 = GUICtrlCreateButton("退 出", 272, 216, 81, 25, $BS_FLAT)
GUICtrlSetTip(-1, "退出")
GUICtrlSetCursor ($Button3, 0)
GUICtrlCreateLabel("加密解密器 V1.0 --风般潦倒工作室", 160, 254, 228, 17)
GUICtrlSetFont(-1, 10, 400, 0, "楷体_GB2312")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg =$Button3
ExitLoop
Case $msg =$Button1
_encrypt()
Case $msg =$Button2
_crack()
EndSelect
WEnd
Exit
;以下程序可以另外存为<ENCRYPT1.AU3>文件
;并在程序开头写入 #include <ENCRYPT1.AU3>
;以下是解密程序
Func _encrypt()
$j=GUICtrlRead($Input1)
$jz=abs($j)
if $jz= "" or $jz=0 or $jz>10 then
$jz=1
endif
$write=GUICtrlRead($Edit1)
$i=1
$i=GUICtrlRead($Edit1)
for $z=1 to $jz
$i = _StringToHex($i)
next
GUICtrlSetData($Edit1,$i)
if GUICtrlRead($Checkbox1) = $GUI_CHECKED then
mailto:$ini=@scriptdir">$ini=@scriptdir &"\encrypt.ini"
$Q=fileexists($ini)
if $Q=0 then
iniwrite($ini,"加密次数","输入文本","生成次数")
iniwrite($ini,"生成密码","输入文本","生成密码")
iniwrite($ini,"生成文本","输入密码","生成文本")
endif
iniwrite($ini,"加密次数",$write,$jz)
iniwrite($ini,"生成密码",$write,$i)
endif
EndFunc
;以下是解密程序
Func _crack()
$s=GUICtrlRead($Edit1)
$str = _HexToString($s)
GUICtrlSetData($Edit1,$str)
if GUICtrlRead($Checkbox1) = $GUI_CHECKED then
mailto:$ini=@scriptdir">$ini=@scriptdir &"\encrypt.ini"
$Q=fileexists($ini)
if $Q=0 then
iniwrite($ini,"加密次数","输入文本","生成次数")
iniwrite($ini,"生成密码","输入文本","生成密码")
iniwrite($ini,"生成文本","输入密码","生成文本")
endif
iniwrite($ini,"生成文本",$s,$str)
endif
return
EndFunc
;以下是算法可以写入strin.au3文件另外放置
;并在本程序开头写入#include <strin.au3>加以连接
;以下是加密算法
Func _StringToHex($strChar)
Local $aryChar, $i, $iDec, $hChar, $file, $strHex,$replace,$replace2,$replace3,$replace4,$replace5,$replace6,$replace7,$replace8,$replace9,$replace10
$aryChar = StringSplit($strChar, "")
For $i = 1 To $aryChar[0]
$iDec = Asc($aryChar[$i])
$hChar = Hex($iDec, 2)
$strHex = $strHex & $hChar
Next
$replace=stringreplace($strHex,"A","&",0)
$replace2=stringreplace($replace,"B","鵀",0)
$replace3=stringreplace($replace2,"C","%",0)
$replace4=stringreplace($replace3,"D","?",0)
$replace5=stringreplace($replace4,"E","`",0)
$replace6=stringreplace($replace5,"3",";",0)
$replace7=stringreplace($replace6,"2","_",0)
$replace8=stringreplace($replace7,"5","^",0)
$replace9=stringreplace($replace8,"_","矤",0)
$replace10=stringreplace($replace9,"6","@",0)
If $replace10 = "" Then
SetError(1)
Return -1
Else
Return $replace10
EndIf
EndFunc
;以下是解密算法
Func _HexToString($strHf)
Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strH, $iOne, $iTwo,$r2,$r3,$r4,$r5,$re6,$r7,$r8,$r9,$r10,$r10
$r2=stringreplace($strHf,"@","6",0)
$r3=stringreplace($r2,"矤","_",0)
$r4=stringreplace($r3,"^","5",0)
$r5=stringreplace($r4,"_","2",0)
$r6=stringreplace($r5,";","3",0)
$r7=stringreplace($r6,"`","E",0)
$r8=stringreplace($r7,"?","D",0)
$r9=stringreplace($r8,"%","C",0)
$r10=stringreplace($r9,"鵀","B",0)
$r11=stringreplace($r10,"&","A",0)
$aryHex = StringSplit($r11, "")
For $i = 1 To $aryHex[0]
$iOne = $aryHex[$i]
$i = $i + 1
$iTwo = $aryHex[$i]
$iDec = Dec($iOne & $iTwo)
$Char = Chr($iDec)
$strChar = $strChar & $Char
Next
If $strChar = "" Then
SetError(1)
Return -1
Else
Return $strChar
EndIf
EndFunc 老大支持你了
但是没看太懂
运行也出错啊
请老大赐教下~~~yct06 yct06
页:
[1]