下面是解密函数,可以将密文"IO@nIL" 解码成 "5125" ,请大家帮忙看看用的什么算法. 最好能帮忙写出加密部分!!
对了,这段代码只能在支持ANSI 的AU3版本上运行...
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseAnsi=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$code = "IO@nIL" ;5125
$dd = decode($code)
MsgBox(0,"",$dd)
Func decode($code)
$codelen = stringlen($code)
$buff1 = 0
$flag2 =2
$flag1 =0
$buff2= 0
$strreturn= ""
;fc f8 f0 e0 c0 8d 40 00
Dim $hexarray[100]
$hexarray[2] = 0xfc
$hexarray[4] = 0xf0
$hexarray[6] = 0xc0
$hexarray[12] = 0x8d
$hexarray[14] = 0x40
$hexarray[16] = 0x00
$maxlen= 0x2710
for $i = 1 to $codelen ;$i ebp-4
$tmp = StringMid($code,$i,1)
if asc($tmp) < 0x3c Then ExitLoop
if $i = $maxlen Then ExitLoop
$buff0 = asc($tmp) - 0x3c
$buff1 = $buff0
if ($flag1 + 6) < 8 Then
Else
$buff0 = BitAND(getal($buff0),0x3f)
$buff0 = BitAND($buff0,0x0ff)
$buff0 = BitShift($buff0 ,getal(6 - $flag2 ))
$buff0 = BitOR(getal($buff0),$buff2)
$strreturn &=chr($buff0)
$flag1 =0
if $flag2 = 6 Then
$flag2 =2
ContinueLoop
Else
$flag2 +=2
EndIf
EndIf
$buff0 = BitShift(getal($buff1),"-"&$flag2)
$buff0 = BitAND($buff0 ,$hexarray[$flag2])
$buff2 = $buff0
$flag1 = $flag1 + (8 - $flag2)
Next
Return $strreturn
EndFunc
Func getal($num)
$bin = Dec2Bin($num)
$bin = StringRight($bin,8)
$num = Bin2Dec($bin)
Return $num
EndFunc
Func Dec2Bin($decimal)
$binary = ''
While $decimal>0
$binary = String(Mod($decimal, 2)) & $binary
$decimal = Int($decimal/2)
WEnd
Return $binary
EndFunc
Func Bin2Dec($binary)
$decimal = 0
For $i = 0 To StringLen($binary) Step 1
$decimal = $decimal + Number(StringMid($binary, StringLen($binary)-$i, 1))*(2^$i)
Next
Return $decimal
EndFunc
[ 本帖最后由 sunless 于 2009-2-8 23:21 编辑 ] |