正在阅读:一个利用随机数加密字串的算法一个利用随机数加密字串的算法

2004-04-09 15:18 出处:CSDN 作者:rainstormmaster 责任编辑:sdq

  Private Function decode(ByVal s As String) As String '解密
    On Error GoTo myERR
    Dim i As Long
    Dim j As Byte
    Dim k As Byte
    Dim m As Byte
    Dim mstr As String
    mstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"
    Dim t1 As String, t2 As String
    Dim buff() As Byte
    Dim n As Long
    n = 0
    For i = 1 To Len(s) Step 2
        t1 = Mid(s, i, 1)
        t2 = Mid(s, i + 1, 1)
        k = InStr(1, mstr, t1) - 1
        m = InStr(1, mstr, t2) - 1
        j = m \ 2 ^ 3
        m = m - j * 2 ^ 3
        ReDim Preserve buff(n)
        buff(n) = j * Len(mstr) + k
        buff(n) = buff(n) Xor m
        n = n + 1
     Next
     decode = StrConv(buff, vbUnicode)
     Exit Function
  myERR:
     decode = ""
  End Function


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:
键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品