如何用asp进行base64加密

2016-01-29 18:10 5 1 收藏

如何用asp进行base64加密,如何用asp进行base64加密

【 tulaoshi.com - ASP 】

  <%
     OPTION EXPLICIT
     const BASE_64_MAP_INIT =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
     dim nl
     ' zero based arrays
     dim Base64EncMap(63)
     dim Base64DecMap(127)

     ' must be called before using anything else
     PUBLIC SUB initCodecs()
          ' init vars
          nl = "<P" & chr(13) & chr(10)
          ' setup base 64
          dim max, idx
             max = len(BASE_64_MAP_INIT)
          for idx = 0 to max - 1
               ' one based string
               Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1)
          next
          for idx = 0 to max - 1
               Base64DecMap(ASC(Base64EncMap(idx))) = idx
          next
     END SUB

     ' encode base 64 encoded string
     PUBLIC FUNCTION base64Encode(plain)

          if len(plain) = 0 then
               base64Encode = ""
               exit function
          end if

          dim ret, ndx, by3, first, second, third
          by3 = (len(plain) 3) * 3
          ndx = 1
          do while ndx <= by3
               first  = asc(mid(plain, ndx+0, 1))
               second = asc(mid(plain, ndx+1, 1))
               third  = asc(mid(plain, ndx+2, 1))
               ret = ret & Base64EncMap(  (first 4) AND 63 )
               ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second 16)
AND 15 ) )
               ret = ret & Base64EncMap( ((second * 4) AND 60) + ((third 64)
AND 3 ) )
               ret = ret & Base64EncMap( third AND 63)
               ndx = ndx + 3
          loop
          ' check for stragglers
          if by3 < len(plain) then
            &

来源:https://www.tulaoshi.com/n/20160129/1504692.html

延伸阅读
标签: ASP
  总是会有很多方法暴露ASP的原程序,造成数据库的密码 路径都可以轻易被其他人搞到,所以对ASP程序实行加密处理是个不错的解决方法。下面来介绍一个工具如果大家感兴趣可以来我主页下载。 minisql.yeah.net 熏衣草乐园 脚本编码器是一种简单的命令行工具,它使脚本设计者可以对最终的脚本进行编码,从而使 Web 主机和 Web 客户不能查看...
代码如下: using System; using System.Security.Cryptography; using System.Text; using System.IO; namespace Common ...{     /**//// summary     /// DESEncrypt加密解密算法。     /// /summary     public sealed class DESEncrypt     ...{  &nb...
标签: 美容 眼部护理
护理眼部 眼霜轻轻揉 雷区1:眼霜面霜混着用 许多人在肌肤保养的时候,眼部和面部就用一瓶面霜搞定,在她们看来,眼霜根本没有必要,质量可靠的面霜完全可以代替眼霜,而眼霜只是质地更细腻价格更昂贵一些而已。但事实上这样是非常不科学的! 真相:其实眼周肌肤和其他肌肤是不同的,眼周肌...
标签: ASP
在目前的网站统计系统决大部分都是CGI的,但编写起来特别复杂,而ASP学起来简单,更有和数据库结合的优点,所以结合自己曾经做过的网站统计系统,和大家探讨一下ASP编写网站统计系统。 大家都看过网易的网站统计系统,它可以统计总访问量,每日平均访问量,当日访问量,最高访问量,最高访问日期,日流量分析,月流量分析,周流量分析,浏览器...
标签: ASP
  Function ReplaceChar ( FstrSource )   dim strRet   if IsNull(FstrSource) then     FstrSource = ""   end if   strRet = Replace ( FstrSource , "&" , "&amp;" )   strRet = Replace ( strRet , "<" , "&lt;" )   strRet = Replace ( strRet , "" , "&gt;" ) ...

经验教程

787

收藏

83
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部