当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > vbs版的解密base64加密的脚本

VBScript
adodb.stream读文件到数组的代码
利用sql语句复制一条或多条记录
百度空间备份脚本baidublogbak.vbs代码分析
vbs版sql查询分析器lcx作品
最新版利用CDO.Message做的vbs下载者
PDF的VBS小程序代码
算阶乘的vbs小程序
vbs后台运行bat删除自身的代码
VB6 ByVal ByRef函数调用
一段提取用户名和md5的vbs代码
vbs fso跨盘移动文件夹的怪问题
vbs删除文本文件的行的函数
显示运行对话框内保存的命令历史的vbs
emule自动关机脚本
IE中用VBScript不提示直接打印的代码
vbs引用另一个vbs的代码
VBScript 剪贴板抓取URL并在浏览器中打开
奇特的js写法,或许可以用来加密躲杀毒软件什么的
自动写入文件上传到指定服务器SoftwareMeteringCLS.vbs源码
一个查看局域网在线IP的vbs脚本

VBScript 中的 vbs版的解密base64加密的脚本


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 89 ::
收藏到网摘: n/a

复制代码 代码如下:

Function fDecode(sStringToDecode)
'This function will decode a Base64 encoded string and returns the decoded string.
'This becomes usefull when attempting to hide passwords from prying eyes.
Const CharList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dim iDataLength, sOutputString, iGroupInitialCharacter
sStringToDecode = Replace(Replace(Replace(sStringToDecode, vbCrLf, ""), vbTab, ""), " ", "")
iDataLength = Len(sStringToDecode)
If iDataLength Mod 4 <> 0 Then
fDecode = "Bad string passed to fDecode() function."
Exit Function
End If
For iGroupInitialCharacter = 1 To iDataLength Step 4
Dim iDataByteCount, iCharacterCounter, sCharacter, iData, iGroup, sPreliminaryOutString
iDataByteCount = 3
iGroup = 0
For iCharacterCounter = 0 To 3
sCharacter = Mid(sStringToDecode, iGroupInitialCharacter + iCharacterCounter, 1)
If sCharacter = "=" Then
iDataByteCount = iDataByteCount - 1
iData = 0
Else
iData = InStr(1, CharList, sCharacter, 0) - 1
If iData = -1 Then
fDecode = "Bad string passed to fDecode() function."
Exit Function
End If
End If
iGroup = 64 * iGroup + iData
Next
iGroup = Hex(iGroup)
iGroup = String(6 - Len(iGroup), "0") & iGroup
sPreliminaryOutString = Chr(CByte("&H" & Mid(iGroup, 1, 2))) & Chr(CByte("&H" & Mid(iGroup, 3, 2))) & Chr(CByte("&H" & Mid(iGroup, 5, 2)))
sOutputString = sOutputString & Left(sPreliminaryOutString, iDataByteCount)
Next
fDecode = sOutputString
End Function