找回密码
 加入
搜索
查看: 2066|回复: 2

有一个字串解密函数,请大家帮忙看看是什么算法.

[复制链接]
发表于 2009-2-8 23:12:44 | 显示全部楼层 |阅读模式
下面是解密函数,可以将密文"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 编辑 ]
发表于 2009-2-9 08:59:21 | 显示全部楼层
作者自己想的算法
发表于 2009-2-9 09:02:34 | 显示全部楼层
源码都有了,你仔细阅读下,加密就不难了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 20:35 , Processed in 0.076120 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表