当前位置:编程学习 > asp >>

我个人现用的加密方法

答案:用时如下

例: 录入:rs.addnew
            rs("password")=encrypt(request("password"))
            rs.update
      验证:if   rs("password")=encrypt(request("password")) then ....
            
function    encrypt(preString)
      Dim texts
      Dim seed
      Dim i,length
      prestring = trim(preString)
      length = len(preString)
      seed = length
      Randomize(length)
      texts = ""
      for i = 1 to length
            seed = int(94*rnd(-asc(mid(preString,i,1))-seed*asc(right(prestring,1)))+32)
            texts = texts & chr(seed) & chr(int(94*rnd(-seed)+32))
      next
    dim dist
    dist=""
    for i = 1 to len(texts)
      if mid(texts,i,1)<>"'"  then
              dist=dist+mid(texts,i,1)
          end if
    next
    encrypt = dist
end function

上一个:奇妙的文件系统对象组件
下一个:ASP中巧用Response属性(转)

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,