现在的位置: 首页 > 综合 > 正文

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

2013年03月23日 ⁄ 综合 ⁄ 共 555字 ⁄ 字号 评论关闭
近是要做一个项目,要求把字符串要求先加密后解密,在网上找了段程序,改了下

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
 

【上篇】
【下篇】

抱歉!评论已关闭.