ASP字符串加密函数EncryptText()
2009-05-06 10:40:13 来源:WEB开发网核心提示:<%'asp 字符串加密函数EncryptText()'strEncryptionKey:加密key字符串,用以区别不同模块加密算法'strTextToEncrypt:欲加密字符串Function EncryptText(ByVal strEncryptionKey, ByVal strT
<%
'asp 字符串加密函数EncryptText()
'strEncryptionKey:加密key字符串,用以区别不同模块加密算法
'strTextToEncrypt:欲加密字符串
Function EncryptText(ByVal strEncryptionKey, ByVal strTextToEncrypt)
Dim outer, inner, Key, strTemp
For outer = 1 To Len(strEncryptionKey)
key = Asc(Mid(strEncryptionKey, outer, 1))
For inner = 1 To Len(strTextToEncrypt)
strTemp = strTemp & Chr(Asc(Mid(strTextToEncrypt, inner, 1)) Xor key)
key = (key + Len(strEncryptionKey)) Mod 256
Next
strTextToEncrypt = strTemp
strTemp = ""
Next
EncryptText = strTextToEncrypt
End Function
%>
在对密码安全性要求较高的程序中,建议不要采用该函数算法。
[]
赞助商链接