学生成绩是由我做的“测试系统”后台传送的!成绩会显示网页地址里,如果能不显示网页地址,那将增强成绩的保密性!!!
你是指地址栏隐藏吗?
加密方法太多了有简单的也有复杂的。
RC4算法
<%
key="sdfjal;dfjaoiejojfafnsanf;aufweijoanfanfaieufowejrwnf;aupagyuweranfsajfagfuoag" '私钥
Sub RC4Initialize(strPwd,ByRef sbox,ByRef key)
dim tempSwap
dim a
dim b
intLength = len(strPwd)
For a = 0 To 255
key(a) = asc(mid(strpwd, (a mod intLength)+1, 1))
sbox(a) = a
next
b = 0
For a = 0 To 255
b = (b + sbox(a) + key(a)) Mod 256
tempSwap = sbox(a)
sbox(a) = sbox(b)
sbox(b) = tempSwap
Next
End Sub
Function EnCrypt(plaintxt, psw)
Dim sbox(255)
Dim key(255)
dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher
i = 0
j = 0
RC4Initialize psw,sbox,key
For a = 1 To Len(plaintxt)
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp
k = sbox((sbox(i) + (sbox(j) Mod 256)) Mod 256)
cipherby = asc(Mid(plaintxt, a, 1)) Xor k
cipher = cipher & "&#"&cipherby&";" 'eg: €
Next
EnCrypt = cipher
End Function
Function DeCrypt(cryptxt, psw)
Dim sbox(255)
Dim key(255)
dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher
i = 0
j = 0
RC4Initialize psw,sbox,key
crypchar=split(cryptxt,";",-1,1) '将密文拆分成每个密文字符放入数组crypchar,但是每个数组元素少一个分号“;”
crypttxtlen=Ubound(crypchar) '返回数组的个数,即加密字符的个数+1(数组中最后一个元素为空)
For a = 1 To crypttxtlen
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp
k = sbox((sbox(i) + (sbox(j) Mod 256)) Mod 256)
tmpcryptxt=mid(crypchar(i-1),3)
cipherby = tmpcryptxt Xor k
cipher = cipher & "&#"&cipherby&";" 'eg: €
Next
DeCrypt = cipher
End Function
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
plaintext=request.form("plaintext")
response.write "<br>输入的明文字符串是:"&plaintext
cryptext=EnCrypt(plaintext,key)
response.write "<br>加密后的密文字符串:" &cryptext
decryptext=DeCrypt(cryptext,key)
response.write "<br>解密输出的字符串是:" &decryptext
end if
%>
这是一种加密方法。
最简单的加密方法就是提取每个字符进行Ascii码加减。
<%
Function EnDeStr(Str,Model)
Dim i
Dim ReStr
ReStr=""
For i=1 To Len(Str)
Select Case Model
Case "EnStr"
ReStr=ReStr&Chr(Asc(Mid(Str,i,1))+100)
Case "DeStr"
ReStr=ReStr&Chr(Asc(Mid(Str,i,1))-100)
End Select
Next
End Function
Response.Write "原字符串为abc"
Response.Write "加密后的字符串"&EnDeStr(Str,"EnStr")
Response.Write "节密后的字符串"&EnDeStr(Str,"DeStr")
%>
这是最简单的加密解密算法。总之字符串加密的算法太多了。