注册 登录
编程论坛 ASP技术论坛

现有一ASP的加密代码,求对应原解密代码!

amwihfku 发布于 2011-05-27 11:04, 491 次点击
<%
password="abc"
li_ch=""
ls_result = ""
for li_pos = 1 to len(password)
    li_ch = asc(mid(password,li_pos,1))
    if li_pos mod 6=1 then
            li_ch = li_ch + asc("z") + li_pos
            if li_ch mod 128 = 0 then
                li_ch = asc("z") - li_pos
            end if
    elseif li_pos mod 6=2 THEN
            li_ch = li_ch + asc("Y") + li_pos
            if li_ch mod 128 = 0 then
                li_ch = asc("Y") - li_pos
            end if
    elseif li_pos mod 6=3 THEN
            li_ch = li_ch + asc("1") + li_pos
            if li_ch mod 128 = 0 then
                li_ch = asc("1") - li_pos
            end if
    elseif li_pos mod 6=4 THEN
            li_ch = li_ch + asc("@") + li_pos
            if li_ch mod 128 = 0 then
                li_ch = asc("@") - li_pos
            end if
    elseif li_pos mod 6=5 THEN
            li_ch = li_ch + asc("!") + li_pos
            if li_ch mod 128 = 0 then
                li_ch = asc("!") - li_pos
            end if
    elseif li_pos mod 6=0 THEN
            li_ch = li_ch + asc("6") + li_pos
            if li_ch mod 128 = 0 then
                li_ch = asc("6") - li_pos
            end if
    end IF
    li_ch = li_ch mod 128
    li_ch = li_ch mod 26 + 65
    ls_result = ls_result + trim(chr(li_ch))
next
response.write "密码="&ls_result
%>
3 回复
#2
dzt00012011-05-27 11:06
不是所有加密过程,都能解密。
#3
amwihfku2011-05-27 11:26
我顶,高手们帮帮
#4
mgmt_asp2011-05-29 13:03
程序代码:
Function revert(str)
Dim i,j,x,y,i_mod,min,max
For i=1 To Len(str)
i_mod=i Mod 6
Select Case i_mod
Case 1
y="z"
Case 2
y="Y"
Case 3
y="1"
Case 4
y="@"
Case 5
y="!"
Case 0
y="6"
End Select
min=i+Asc(y)+97
max=i+Asc(y)+122
For j=min To max
x=j Mod 128 Mod 26
If x=Asc(Mid(str,i,1))-65 Then
revert=revert&Chr(j-Asc(y)-i)
End If
Next
Next
End Function
这个可以解26个小写字母组成的密码,长度不限

[ 本帖最后由 mgmt_asp 于 2011-5-29 15:30 编辑 ]
1