ASP 改良版MD5、SHA256多重加密类(二次及多次)(5)


For lCount = 0 To 3
lByte = RShift(lValue, lCount * BITS_TO_A_BYTE) And MD5_m_lOnBits(BITS_TO_A_BYTE - 1)
WordToHex = WordToHex & Right("0" & Hex(lByte), 2)
Next
End Function

'MD5主函数 MD5(字符串,编码位)
Public Function MD5(byVal sMessage, byVal sType)
Dim x
Dim k
Dim AA
Dim BB
Dim CC
Dim DD
Dim a
Dim b
Dim c
Dim d
Const S11 = 7
Const S12 = 12
Const S13 = 17
Const S14 = 22
Const S21 = 5
Const S22 = 9
Const S23 = 14
Const S24 = 20
Const S31 = 4
Const S32 = 11
Const S33 = 16
Const S34 = 23
Const S41 = 6
Const S42 = 10
Const S43 = 15
Const S44 = 21
x = ConvertToWordArray(sMessage) '加密步骤1:数组转换
a = &H67452301
b = &HEFCDAB89
c = &H98BADCFE
d = &H10325476
For k = 0 To UBound(x) Step 16
AA = a
BB = b
CC = c
DD = d
'加密步骤2:编码转换
MD5_FF a, b, c, d, x(k + 0), S11, &HD76AA478
MD5_FF d, a, b, c, x(k + 1), S12, &HE8C7B756
MD5_FF c, d, a, b, x(k + 2), S13, &H242070DB
MD5_FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE
MD5_FF a, b, c, d, x(k + 4), S11, &HF57C0FAF
MD5_FF d, a, b, c, x(k + 5), S12, &H4787C62A
MD5_FF c, d, a, b, x(k + 6), S13, &HA8304613
MD5_FF b, c, d, a, x(k + 7), S14, &HFD469501
MD5_FF a, b, c, d, x(k + 8), S11, &H698098D8
MD5_FF d, a, b, c, x(k + 9), S12, &H8B44F7AF
MD5_FF c, d, a, b, x(k + 10), S13, &HFFFF5BB1
MD5_FF b, c, d, a, x(k + 11), S14, &H895CD7BE
MD5_FF a, b, c, d, x(k + 12), S11, &H6B901122
MD5_FF d, a, b, c, x(k + 13), S12, &HFD987193
MD5_FF c, d, a, b, x(k + 14), S13, &HA679438E
MD5_FF b, c, d, a, x(k + 15), S14, &H49B40821
MD5_GG a, b, c, d, x(k + 1), S21, &HF61E2562
MD5_GG d, a, b, c, x(k + 6), S22, &HC040B340
MD5_GG c, d, a, b, x(k + 11), S23, &H265E5A51
MD5_GG b, c, d, a, x(k + 0), S24, &HE9B6C7AA
MD5_GG a, b, c, d, x(k + 5), S21, &HD62F105D
MD5_GG d, a, b, c, x(k + 10), S22, &H2441453
MD5_GG c, d, a, b, x(k + 15), S23, &HD8A1E681
MD5_GG b, c, d, a, x(k + 4), S24, &HE7D3FBC8
MD5_GG a, b, c, d, x(k + 9), S21, &H21E1CDE6
MD5_GG d, a, b, c, x(k + 14), S22, &HC33707D6
MD5_GG c, d, a, b, x(k + 3), S23, &HF4D50D87
MD5_GG b, c, d, a, x(k + 8), S24, &H455A14ED
MD5_GG a, b, c, d, x(k + 13), S21, &HA9E3E905
MD5_GG d, a, b, c, x(k + 2), S22, &HFCEFA3F8
MD5_GG c, d, a, b, x(k + 7), S23, &H676F02D9
MD5_GG b, c, d, a, x(k + 12), S24, &H8D2A4C8A
MD5_HH a, b, c, d, x(k + 5), S31, &HFFFA3942
MD5_HH d, a, b, c, x(k + 8), S32, &H8771F681
MD5_HH c, d, a, b, x(k + 11), S33, &H6D9D6122
MD5_HH b, c, d, a, x(k + 14), S34, &HFDE5380C
MD5_HH a, b, c, d, x(k + 1), S31, &HA4BEEA44
MD5_HH d, a, b, c, x(k + 4), S32, &H4BDECFA9
MD5_HH c, d, a, b, x(k + 7), S33, &HF6BB4B60
MD5_HH b, c, d, a, x(k + 10), S34, &HBEBFBC70
MD5_HH a, b, c, d, x(k + 13), S31, &H289B7EC6
MD5_HH d, a, b, c, x(k + 0), S32, &HEAA127FA
MD5_HH c, d, a, b, x(k + 3), S33, &HD4EF3085

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

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