首页 > 编程 > ASP > 正文

ASP字符串加密函数EncryptText()

2024-05-04 11:06:48
字体:
来源:转载
供稿:网友
<%
'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
%>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表