可逆加密解密程序(ASP版)

近是要做一个项目,要求把字符串要求先加密后解密,在网上找了段程序,改了下
Dim str:str = "*(^#123"
Response.Write(
str&"<br />")
str = Encrypt(str)
Response.Write(
str&"<br />")
str = Decrypt(str)
Response.Write(
str)

''解密函数
Function Decrypt(dcode)  
  
Dim texts 
  
Dim i 
  
For i=1 To Len(dcode) 
    texts 
= texts & Chr(Asc(Mid(dcode,i,2))-i+1'在此随便加个数字改变加密后的值
  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-1'减相应的值才能还原:)
  Next
  Encrypt 
= texts 
End Function
 
posted @ 2008-06-10 09:39  Kenny田  阅读(825)  评论(0编辑  收藏  举报