Imports System.Security.Cryptography
Module MD5
Public Function strMd5(ByVal InputString As String) As String
Dim MD5
Dim dataToHash As Byte() = (New System.Text.ASCIIEncoding).GetBytes(InputString)
Dim hashvalue As Byte() = CType(System.Security.Cryptography.CryptoConfig.CreateFromName("MD5"), System.Security.Cryptography.HashAlgorithm).ComputeHash(dataToHash)
Dim i As Integer
For i = 0 To 15 '选择32位字符的加密结果
MD5 += Hex(hashvalue(i)).ToLower
Next
Return MD5
End Function
End Module
Module MD5
Public Function strMd5(ByVal InputString As String) As String
Dim MD5
Dim dataToHash As Byte() = (New System.Text.ASCIIEncoding).GetBytes(InputString)
Dim hashvalue As Byte() = CType(System.Security.Cryptography.CryptoConfig.CreateFromName("MD5"), System.Security.Cryptography.HashAlgorithm).ComputeHash(dataToHash)
Dim i As Integer
For i = 0 To 15 '选择32位字符的加密结果
MD5 += Hex(hashvalue(i)).ToLower
Next
Return MD5
End Function
End Module