|
发表于 2008-12-13 08:49:01
|
显示全部楼层
晕,有什么难的,你有IIS么?没IIS当然难了
打开浏览器看调试信息,错什么就改什么
- <%
- response.write cipher("aaaaaaaaaaaaa")'加密测试
- response.write "<br>"
- response.write decipher("NbE4>hr)y>*u5")'解密测试
- Function cipher(stext) '密码加密程序
- Const min_asc = 32
- Const max_asc = 126
- Dim num_asc
- num_asc = max_asc - min_asc + 1
- Dim offset
- Dim strlen
- Dim i
- Dim ch
- Dim ptext
- offset = 123
- Rnd (-1)
- Randomize (offset)
- strlen = Len(stext)
- For i = 1 To strlen
- ch = Asc(Mid(stext, i, 1))
- If ch >= min_asc And ch <= max_asc Then
- ch = ch - min_asc
- offset = Int((num_asc + 1) * Rnd())
- ch = ((ch + offset) Mod num_asc)
- ch = ch + min_asc
- ptext = ptext & Chr(ch)
- End If
- Next
- cipher = ptext
- End Function
- Function decipher(stext) '密码解密程序
- Const min_asc = 32 '最小ASCII码
- Const max_asc = 126 '最大ASCII码 字符
- Dim num_asc
- num_asc = max_asc - min_asc + 1
- Dim offset
- Dim strlen
- Dim i
- Dim ch
- Dim ptext
- offset = 123
- Rnd (-1)
- Randomize (offset)
- strlen = Len(stext)
- For i = 1 To strlen
- ch = Asc(Mid(stext, i, 1)) '取字母转变成ASCII码
- If ch >= min_asc And ch <= max_asc Then
- ch = ch - min_asc
- offset = Int((num_asc + 1) * Rnd())
- ch = ((ch - offset) Mod num_asc)
- If ch < 0 Then
- ch = ch + num_asc
- End If
- ch = ch + min_asc
- ptext = ptext & Chr(ch)
- End If
- Next
- decipher = ptext
- End Function
- %>
复制代码 |
评分
-
查看全部评分
|