日期:2012-12-17  浏览次数:20914 次

用时如下

例: 录入: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