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

VBScript
用vbscript得到注册表中是否存在某个值
用vbscript实现修改屏幕保护的等待时间长度
用vbscript实现在消息框中显示一个超链接
用vbscript实现将脚本的输出复制到剪贴板
视频转换大师WinMPG Video Convert 6.63
用vbs实现取消隐藏文件夹中的所有文件
用vbscript实现从文本文件中删除所有重复行的代码
用vbscript实现在文本文件中搜索两个项
用vbscript实现启用 Caps Lock (大写)键
vbscript和javascript版的15位, 18位的身份证号码的验证函数.以及根据身份证取省份,生日,性别
发老兵及海洋VBS解包工具代码
把vbscript发挥到它的极限应用之一(数组)!!!
VBScript:Join 函数一个不太常用,却很有用的函数
最新恶意复制型病毒autorun.inf,stNP.VBS,NP.VBS代码简单解析和解决方法
用vbscript脚本实现返回 IP 配置数据的代码
用vbs实现配置静态 IP 地址
用vbs得到计算机的 IP 地址
用vbs实现枚举网络连接的代码
IIS管理脚本之adsutil.vbs的使用说明
用VBS修改IIS Metabase的代码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 91 ::
收藏到网摘: 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