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

VBScript
vbs在网页中显示服务
vbs得没公开对象
unpack.vbs
使用批处理文件异地备份数据库(最近几天的数据)
VBScript 中的字节数据操作函数
切换dos并dir的vbs
杀毒的对vbs相当敏感 免杀
多进程的vbs脚本
Windows管理脚本学习
15分钟提醒一次,珍惜时间啊
从一个VBS脚本学习一点点东西
exe2swf 工具(Adodb.Stream版)
使用脚本自动修改ip设置
深入挖掘Windows脚本技术
用VBSCRIPT控制ONSUBMIT事件
VBS中Select CASE的其它用法
vbscript 可以按引用传递参数吗?
下载文件到本地运行的vbs
飘叶千夫指源代码,又称qq刷屏器
SendKeys参考文档

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


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