上一篇:用Asp写个加密和解密的类(1) >>
用Asp写个加密和解密的类(2)
for iCount=1 to lenString step 3
temPBinary = Mid(paramString, iCount, 3)
response.write tempBinary
tempByteOne= Asc(Mid(tempBinary, 1, 1)): tempSaveBitsOne=tempByteOne And 3
tempByteTwo = Asc(Mid(tempBinary, 2, 1)): tempSaveBitsTwo=tempByteTwo And 15
tempChar = Asc(Mid(tempBinary, 3, 1))
tempByteOne = Mid(sBASE_64_CHARACTERS, ((tempByteOne And 252) 4)+ 1, 1)
tempByteTwo = Mid(sBASE_64_CHARACTERS, (((tempByteTwo And 240)16) Or (tempSaveBitsOne * 16) And &HFF) + 1, 1)
tempByteThree = Mid(sBASE_64_CHARACTERS, (((tempChar And 192)64) Or (tempSaveBitsTwo * 4) And &HFF) + 1, 1)
tempByteFour = Mid(sBASE_64_CHARACTERS, (tempChar And 63) +1,1)
tempString = tempByteOne & tempByteTwo &tempByteThree& tempByteFour returnValue=returnValue &tempStringnext
*************************end
*************************begin处理最后剩余的几个字符
if mod3String>0 then
tempBinary = Mid(paramString, iCount, mod3String)
if mod3String=1 then
tempString = tempBinary & Chr(64) & Chr(64) &Chr(64)用@号补足位数
else tempString = tempBinary & Chr(64) &Chr(64)用@号补足位数
end if
returnValue=returnValue & tempString
end if
*************************end处理最后剩余的几个字符
Encode=returnValue end if end function
********************************************
end将Ansi编码的字符串进行Base64编码
********************************************
********************************************
end将Base64编码字符串转换成Ansi编码的字符串
********************************************
public function Decode(paramString)
tempString=
returnValue=
lenString=len(paramString)
if lenString<1 then
Decode=returnValue
else
mod4String=lenString mod 4
if mod4String >0 then 字符串长度应当是4的倍数
Decode=returnValue
else begin判断是不是@号
if Mid(paramString, lenString-1, 1) = @ then
mod4String=2
end if
if Mid(paramString, lenString-2, 1) = @ then
mod4String=1
end if
end判断是不是@号
if mod4String>0 then
lenString=lenString-4
******************************begin
for iCount=1 to lenString step 4
tempString = Mid(paramString, iCount, 4)
tempByteOne = InStr(sBASE_64_CHARACTERS, Mid(tempString, 1, 1))-1
tempByteTwo = InStr(sBASE_64_CHARACTERS, Mid(tempString, 2, 1))-1
tempByteThree = InStr(sBASE_64_CHARACTERS, Mid(tempString, 3,1))- 1
tempByteFour = InStr(sBASE_64_CHARACTERS, Mid(tempString, 4, 1))-1
tempByteOne = Chr(((tempByteTwo And 48) 16) Or (tempByteOne *4)And &HFF) tempByteTwo = & Chr(((tempByteThree And 60)4) Or (tempByteTwo * 16) And &HFF)
tempByteThree = Chr((((tempByteThree And 3) * 64) And &HFF)Or(tempByteFour And 63))
tempString=tempByteOne & tempByteTwo & tempByteThree
returnValue=returnValue & tempString
next
******************************end
处理最后剩余的几个字符
if mod4String > 0 then
tempString=center(center(paramString,4),mod4String)
returnValue = returnValue & tempString
end if
Decode=returnValue
end if
end if
end function
********************************************
end将Base64编码字符串转换成Ansi编码的字符串
********************************************
作者:CSDN pxjianke
下一篇:asp判断函数一览及网页制作常用技(1) >>
相关文章:
- · 使用@Page指令的Src属性 简化对老版本的asp.net程序的维护
- · 一个通用的保护ASP系统的方法
- · ASP.NET 2.0中DataTable小兵变大将
- · asp.net开发web项目-vss集成环境配置
- · ASP.NET中为DataGrid添加合计字段
- · 部署ASP.NET(包含.net framework 和MDAC)
- · 当DataSet中包含主/子表时,Update更新步骤
- · ASP的含义、功能和选择
- · ASP中巧用Response属性 -- contenttype
- · ASP进阶学习必经之认识数学函数11种
- · 初学ASP:入门经验谈
- · ASP两种调试程序的方法
- · 学以致用 驳“ASP低能论”
- · 动态网页初学:ASP个人上手指南
- · ASP内置对象Request和Response详解
- · 一些左右你网页水平的教程
- · ASP站长助手源代码
- · ASP错误大全
- · 关于学习ASP和编程的28个观点
- · 人文的ASP开发基础入门之简介
- · ASP小偷(远程数据获取)程序的入门教程
- · VBScript语法速查及实例说明
- · 带多选项的域名查询
- · Open FSO
- · ASP学习前准备
- · ASP教程:Are you ready?
- · Application对象
- · ASP教程之ASP基础简介
- · Cookie集合
- · ASP的开发工具
- · 数据库连接(无错)
- · session在验证管理登陆时的使用方法
- · Request和Response对象
- · asp当中判断函数一览
- · ASP脚本循环语句
- · C/S、B/S软件技术上的比较
- · ASP VBScript 函数速查表
- · 初学asp的朋友 asp20条
