*************************begin
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
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器