asp 一些支付接口(28)



        lMessageLength = LenB(sMessage)

        lNumberOfWords = (((lMessageLength + ((MODULUS_BITS - CONGRUENT_BITS) \ ASP_BITS_TO_A_BYTE)) \ (MODULUS_BITS \ ASP_BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS \ ASP_BITS_TO_A_WORD)
        ReDim lWordArray(lNumberOfWords - 1)

        lBytePosition = 0
        lByteCount = 0
        Do Until lByteCount >= lMessageLength
            lWordCount = lByteCount \ ASP_BYTES_TO_A_WORD
            lBytePosition = (lByteCount Mod ASP_BYTES_TO_A_WORD) * ASP_BITS_TO_A_BYTE
            lWordArray(lWordCount) = lWordArray(lWordCount) Or ASP_LShift(AscB(MidB(sMessage, lByteCount + 1, 1)), lBytePosition)
            lByteCount = lByteCount + 1
        Loop

        lWordCount = lByteCount \ ASP_BYTES_TO_A_WORD
        lBytePosition = (lByteCount Mod ASP_BYTES_TO_A_WORD) * ASP_BITS_TO_A_BYTE

        lWordArray(lWordCount) = lWordArray(lWordCount) Or ASP_LShift(&H80, lBytePosition)

        lWordArray(lNumberOfWords - 2) = ASP_LShift(lMessageLength, 3)
        lWordArray(lNumberOfWords - 1) = ASP_RShift(lMessageLength, 29)

        ASP_ConvertToWordArray = lWordArray
    End Function

    Private Function ASP_WordToHex(lValue)
        Dim lByte
        Dim lCount

        For lCount = 0 To 3
            lByte = ASP_RShift(lValue, lCount * ASP_BITS_TO_A_BYTE) And ASP_m_lOnBits(ASP_BITS_TO_A_BYTE - 1)
            ASP_WordToHex = ASP_WordToHex & Right("0" & Hex(lByte), 2)
        Next
    End Function

    Public Function ASP_MD5(sMessage)
        ASP_m_lOnBits(0) = CLng(1)
        ASP_m_lOnBits(1) = CLng(3)
        ASP_m_lOnBits(2) = CLng(7)
        ASP_m_lOnBits(3) = CLng(15)
        ASP_m_lOnBits(4) = CLng(31)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2294.html