手机
当前位置:查字典教程网 >编程开发 >ASP教程 >asp字符串加密解密函数
asp字符串加密解密函数
摘要:

<%

A_Key=split("96,44,63,80",",")'定义密钥

'*********加密的过程*********

FunctionEnCrypt(m)

DimstrChar,iKeyChar,iStringChar,I

k=0

forI=1toLen(m)

iKeyChar=Cint(A_Key(k))

iStringChar=Asc(mid(m,I,1))'获取字符的ASCII码值

iCryptChar=iKeyCharXoriStringChar'进行异或运算

'对密钥进行移位运算

Ifk<3Then

k=k+1

Else

k=0

EndIf

c=c&Chr(iCryptChar)

next

EnCrypt=c

EndFunction

'*********解密的过程*********

FunctionDeCrypt(c)

DimstrChar,iKeyChar,iStringChar,I

k=0

forI=1toLen(c)

iKeyChar=Cint(A_Key(k))

iStringChar=Asc(mid(c,I,1))

iDeCryptChar=iKeyCharXoriStringChar'进行异或运算

'对密钥进行移位运算

Ifk<3Then

k=k+1

Else

k=0

EndIf

strDecrypted=strDecrypted&Chr(iDeCryptChar)

next

DeCrypt=strDecrypted

EndFunction

%>

【asp字符串加密解密函数】相关文章:

收集asp的常用函数

asp 中常用的文件处理函数

ASP常用的函数

一个实用asp分页函数

改进 ASP 的字符串处理性能

另类的文件上传解决方案

asp 日期格式化函数

ASP中字符与数字操作函数总结

一段在asp中加密与解密对应的函数

编写asp代码截取字符串

精品推荐
分类导航