1. 加密 .inc代码
<%
StrSQL="DBQ="+server.mappath("xxx.mdb")+";DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open StrSQL
sub CloseConn()
conn.close
set conn=nothing
end sub
function decrypt(dcode)
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,2))-i)
next
decrypt=texts
end function
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,2))+i)
next
encrypt = texts
end function
%>
2. 解密 .asp代码(保存为jiemi.asp)
<title>后台密码移位加密解密程序</title><table width="48%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000"><form name="form" method="POST" action="jiemi.asp"><tr bgcolor="#FFFFFF"><td align=left>明文:<input name="mingwen"><input name="cmdok" type="submit" value="破解"><%=encrypt(request.form("mingwen"))%></td></tr><tr bgcolor="#FFFFFF"><td align=left>密文:<input name="miwen"><input name="cmdok" type="submit" value="破解"><%=decrypt(request.form("miwen"))%></td></tr></form></table>
<%
function decrypt(dcode)
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,2))-i)
next
decrypt=texts
end function
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,2))+i)
next
encrypt = texts
end function
mima=encrypt(password)
%>