惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - Casm

C#代码与javaScript函数的相互调用 窗口A打开窗口B,关闭窗口B,窗口B关闭窗口A(web窗口互关问题) - Casm - 博客园 3G网络 无聊~写个计算器...待续 下拉框的郁闷! - Casm 一个记事本的例子(作者kiki) 关闭用户打开的进程处理 如何在Vista IIS 7 中用 vs2005 调试 Web 项目 回顾windows界面的20年历程(三)(转) 回顾windows界面的20年历程(二)(转) 回顾windows界面的20年历程(一)(转) google的历史 一个新手的成长过程 传奇3封包加解密C#版 VB 热血江湖V170外挂 全部 源码 给学做嵌入式开发外挂技术的新人一点建议 网络游戏外挂编写基础(1) 到处都有,但是自己还是要常常看看! 使用vs2005调试javascript
传奇3加密解密-VB2005
Casm · 2007-04-26 · via 博客园 - Casm

'By:sefwin
    '解密
    Private Function Decode6Bit(ByVal bytes() As Byte) As Byte()
        Dim i As Integer, j As Integer, m As Integer = 0

        Dim bLen As Integer = bytes.Length Mod 4
        If bLen <> 0 Then
            bLen = 4 - bLen
            ReDim Preserve bytes(bytes.Length + bLen - 1)
        End If
        Dim _sBytes((bytes.Length * 3) / 4 - 1) As Byte

        For i = 0 To bytes.Length - 1 Step 4
            '将数组里的每一数减去 &H3C(60)
            For j = i To i + 3
                If bytes(j) >= &H3C Then
                    bytes(j) = bytes(j) - &H3C
                End If
            Next
            '四个字节的数据解密后为3个字节,
            '例:未解密的字符串:Ysap 
            '    解密后的字符串:wyt 
            '方法:
            'w = Y << 2 + (s << 2) >> 6
            'y = s << 4 + (a << 2) >> 4
            't = a << 6 + (p << 2) >> 2
            _sBytes(m) = (bytes(i) << 2) + ((bytes(i + 1) << 2) >> 6)
            _sBytes(m + 1) = (bytes(i + 1) << 4) + ((bytes(i + 2) << 2) >> 4)
            _sBytes(m + 2) = (bytes(i + 2) << 6) + ((bytes(i + 3) << 2) >> 2)
            m += 3
        Next

        Return _sBytes
    End Function

    '加密
    Private Function Encode6Bit(ByVal bytes() As Byte) As Byte()
        Dim i As Integer, m As Integer = 0
        Dim _Bytes() As Byte = bytes
        '计算_Bytes数组的长度是否等于3的倍数
        '假设_Bytes的长度 = 10 ,则 n = 2 ,_Bytes.Length + n = 3的倍数
        Dim n As Integer = _Bytes.Length Mod 3
        If n <> 0 Then
            n = 3 - n
            '重新定义数组的元素个数,加入 Preserve 关键字 使原始数据不受影响
            ReDim Preserve _Bytes(_Bytes.Length + n - 1)
        End If
        Dim _EnBytes((_Bytes.Length * 4) / 3 - 1) As Byte
        '将字符串以3个字节为一段,每个字节8位,共24位,将其分成4组,每一组有6位,在每组首部加2位后
        '变成4组8位的,共32位
        '然后每一组再加 &H3C 后,得到了加密后的字符串
        '例如:未加密的字符串:123
        '      加密后的字符串:HODo
        For i = 0 To _Bytes.Length - 1 Step 3
            _EnBytes(m) = (_Bytes(i) >> 2) + &H3C
            _EnBytes(m + 1) = ((_Bytes(i) << 6) >> 2) + (_Bytes(i + 1) >> 4) + &H3C
            _EnBytes(m + 2) = ((_Bytes(i + 1) << 4) >> 2) + (_Bytes(i + 2) >> 6) + &H3C
            _EnBytes(m + 3) = ((_Bytes(i + 2) << 2) >> 2) + &H3C
            m += 4
        Next
        ReDim Preserve _EnBytes(_EnBytes.Length - n - 1)
        Return _EnBytes
    End Function