Function GetMD5Hash(ByVal strToHash As String) As String
Dim md5Obj As New MD5CryptoServiceProvider()
Dim bytesToHash() As Byte = Encoding.ASCII.GetBytes(strToHash)
bytesToHash = md5Obj.ComputeHash(bytesToHash)
Dim strResult As New StringBuilder()
For Each b As Byte In bytesToHash
strResult.Append(b.ToString("x2"))
Next
Return strResult.ToString()
End Function
使用方式:GetMD5Hash("需要加密的字符串")