大家都知道RC4字符加密/解密,但是现在新版的根本不支持了,所以本人花了一天时间搞这个字符加密/解密
支持新版并支持中文。有高人可以指点一下,但别打击喔。
11月24日重新更新密码计算方法,密码已经支持任何字符,并添加密码等级,使密码更复杂
现在加密过的字符在没有原密码情况下破解几乎为0(要看你什么设密码了)
测试过用10位数加密150行,每行字符小于200个字 的文件 只要0.3秒,解密要0.4秒
密码位数越长,花的时间就会加大一点
$sd='qin147原创的字符加密器'
$jm=_jiami(1, $sd, '我的密码pass#$*_ (@',2) ;_jiami( 1加密 0解密 , 要加密字符, 密码 , 等级 ) 密码可以是任何字符(如中文或符号) 等级0-9
$qm=_jiami(0, $jm, '我的密码pass#$*_ (@',2)
MsgBox(0,'qin147字符加密器测试','加密后:'&$jm&@LF _
&@LF _
&'解密后:'&$qm)
Func _jiami($jiami_lp, $jiami_txt,$jiami_pas,$jiami_lev)
Local $tlev,$bhb,$jjxc =1,$Num
Local $jh[100]
If $jiami_txt='' Or $jiami_pas='' Or StringLen ($jiami_pas) > 100 _
Or $jiami_lev > 9 Or Int($jiami_lev)<>$jiami_lev Or $jiami_lev < 0 Then Return -1
If $jiami_lp = 1 Then
$sosu=StringLen ($jiami_pas)
For $pa_s=1 To $sosu
$jh[$pa_s]=Asc(StringMid($jiami_pas,$pa_s,1))
$Num=$Num&$jh[$pa_s]
If $jjxc > 3 Then $jjxc=1
If $jjxc=1 Then
$bhb=Int($bhb+$jh[$pa_s])
ElseIf $jjxc=2 Then
$bhb=Int($bhb*$jh[$pa_s])
ElseIf $jjxc=3 Then
$bhb=Int($bhb-$jh[$pa_s])
EndIf
$jjxc +=1
Next
$Num=StringLeft($Num, $jiami_lev)&$bhb&StringRight($Num, $jiami_lev)
$jiami_txt=StringTrimLeft(StringToBinary($jiami_txt,2),2)
$y_si=$sosu
$j_si=1
Do
$vi=StringMid($jh[$j_si],1,1)+StringMid($jh[$y_si],StringLen ($jh[$y_si]),1)
$tempa=StringMid($jiami_txt,1,$vi-1)
$tempb=StringMid($jiami_txt,$vi)
$jiami_txt=$tempa&$jh[$j_si]&$tempb
$y_si -=1
$j_si +=1
Until $y_si <= 0 And $j_si >= $sosu
$st=StringLen ($Num)
$txtshi=StringLen ($jiami_txt)
For $kl=1 To $st
$rtemp=''
For $vn=1 To $txtshi Step StringMid($Num,$kl,1)+30
$rtemp = StringMid($jiami_txt,$vn,StringMid($Num,$kl,1)+30)&$rtemp
Next
$jiami_txt=$rtemp
Next
Return $jiami_txt
ElseIf $jiami_lp = 0 Then
$sosu=StringLen ($jiami_pas)
For $pa_s=1 To $sosu
$jh[$pa_s]=Asc(StringMid($jiami_pas,$pa_s,1))
$Num=$Num&$jh[$pa_s]
If $jjxc > 3 Then $jjxc=1
If $jjxc=1 Then
$bhb=Int($bhb+$jh[$pa_s])
ElseIf $jjxc=2 Then
$bhb=Int($bhb*$jh[$pa_s])
ElseIf $jjxc=3 Then
$bhb=Int($bhb-$jh[$pa_s])
EndIf
$jjxc +=1
Next
$Num=StringLeft($Num, $jiami_lev)&$bhb&StringRight($Num, $jiami_lev)
$st=StringLen ($Num)
Do
$txtshi=StringLen ($jiami_txt)
$rtemp=''
Do
$rtemp =$rtemp&StringRight ($jiami_txt, StringMid($Num,$st,1)+30)
$jiami_txt=StringTrimRight ($jiami_txt, StringMid($Num,$st,1)+30)
$txtshi -= StringMid($Num,$st,1)+30
Until $txtshi <= 0
$jiami_txt=$rtemp
$st -=1
Until $st <= 0
$y_si=$sosu
$j_si=1
Do
$vi=StringMid($jh[$y_si],1,1)+StringMid($jh[$j_si],StringLen ($jh[$j_si]),1)
$tempa=StringMid($jiami_txt,1,$vi-1)
$tempb=StringMid($jiami_txt,$vi+StringLen ($jh[$y_si]))
$jiami_txt=$tempa&$tempb
$y_si -=1
$j_si +=1
Until $y_si <= 0
$jiami_txt='0x'&$jiami_txt
$jiami_txt = BinaryToString($jiami_txt,2)
Return $jiami_txt
Else
Return -1
EndIf
EndFunc
[ 本帖最后由 qin147 于 2008-11-24 15:33 编辑 ] |