⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base16

📁 WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品
💻
字号:
Public Table, Queue, Mapping

Private Sub Class_Initialize()
    Table = Array(10, 113, 86, 28, 52, 123, 110, 8, 32, 46, 84, 105, 50, 121, 103, 39, 65, 36, 56, 124, 89, 109, 88, 49, 122, 67, 3, 115, 13, 79, 81, 83, 117, 74, 34, 53, 14, 6, 70, 62, 45, 76, 95, 107, 100, 20, 102, 35, 93, 48, 116, 98, 91, 16, 11, 80, 57, 71, 25, 41, 18, 30, 118, 31, 99, 47, 111, 60, 61, 94, 1, 40, 21, 114, 101, 37, 69, 78, 77, 73, 12, 92, 104, 43, 0, 82, 126, 85, 15, 75, 108, 90, 51, 42, 27, 125, 29, 87, 68, 66, 72, 19, 7, 5, 58, 26, 96, 17, 9, 112, 24, 54, 106, 119, 2, 44, 127, 4, 22, 33, 120, 97, 63, 23, 59, 38, 55, 64)
    Queue = Array(&H0, &H1, &H2, &H3, &H4, &H5, &H6, &H7, &H8, &H9, &HA, &HB, &HC, &HD, &HE, &HF)
    Mapping = Array(&HF, &H2, &H9, &HD, &H5, &H6, &H0, &HB, &HE, &H1, &H3, &H4, &HC, &H7, &H8, &HA)
    Randomize
End Sub

Public Function Encode(ByVal strData)
    Dim arr, tmp, i
    Dim x, y, k
    Dim hByte, lByte
    arr = BytesToArray(StringToBytes(strData, LOCAL_CHARSET))
    ReDim tmp(UBound(arr) * 2 + 1)
    For i = 0 To UBound(arr)
        x = ArrayIndex(Queue, RShift(arr(i), 4))
        y = ArrayIndex(Queue, arr(i) And &HF)
        k = Int(Rnd() * 8)
        hByte = Table(k * 16 + x)
        k = Int(Rnd() * 8)
        lByte = Table(k * 16 + y)
        tmp(i * 2) = lByte
        tmp(i * 2 + 1) = hByte
    Next
    Encode = Base64Encode(ArrayToBytes(tmp))
End Function

Public Function Decode(ByVal strData)
    Dim arr, tmp, i, x
    Dim hByte, lByte
    Dim vtData
    vtData = Base64Decode2(strData)
    If VarType(vtData) = (vbByte Or vbArray) Then
        arr = BytesToArray(vtData)
        ReDim tmp((UBound(arr) - 1) / 2)
        For i = 0 To UBound(arr)
            x = ArrayIndex(Table, arr(i))
            If (i + 1) Mod 2 = 0 Then
                hByte = Queue(x Mod 16)
                tmp((i + 1) / 2 - 1) = LShift(hByte, 4) Or lByte
            Else
                lByte = Queue(x Mod 16)
            End If
        Next
        Decode = BytesToString(ArrayToBytes(tmp), LOCAL_CHARSET)
    End If
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -