梁博拿冠军的歌曲:ASP帮忙解释一下这个函数

来源:百度文库 编辑:高校问答 时间:2024/05/07 11:54:03
function decrypt(dcode)
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,2))-i)
next
decrypt=texts
end function
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,2))+i)
next
encrypt = texts
end function

function decrypt(dcode) ’定义一个函数decrypt,参数dcode
dim texts '变量
dim i
for i=1 to len(dcode) ’循环参数的长度次数len
texts=texts & chr(asc(mid(dcode,i,2))-i) '把texts的值和原来的连接起来 chr得到字符传,因为后面的asc把字符转ASCII了,mid就是把参数在I的位置到接下去的两个,就是截两个字符而已
next ’函数结束
decrypt=texts '把texts赋给decrypt就是函数的返回值
end function '结束
’下面这个函数一样,只是+和-的差别
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,2))+i)
next
encrypt = texts
end function