Hi,
I'm trying to use the MD5CryptoServiceProvider class to create the hash code for a string.
However, it seems i can only return it as a base64 code, and i need the string as hex.
How can i convert it?
Thanks.
Here is my code:
I'm trying to use the MD5CryptoServiceProvider class to create the hash code for a string.
However, it seems i can only return it as a base64 code, and i need the string as hex.
How can i convert it?
Thanks.
Here is my code:
Visual Basic:
Private Function computeMD5(ByVal plainText As String) As String
Dim ue As New UnicodeEncoding
Dim bytes() As Byte = ue.GetBytes(plainText)
Dim md5 As New Security.Cryptography.MD5CryptoServiceProvider
Dim hashBytes As Byte()
hashBytes = md5.ComputeHash(bytes)
' Convert result into a base64-encoded string.
Dim hashString As String
hashString = Convert.ToBase64String(hashBytes)
' Return the result
Return hashString
End Function