Hi, I have to convert a string to an MD5 hash...
I know that there is a class available, as you can read beneath:
But, this code returns something that has maybe the same length of an MD5 hash, but surely does not look like one (containing e.g. these characters: =,T, O, Q, etc.). This is not possible for an MD5 since MD5 is always in hexadecimal characters...
How solve this?
Thanks
I know that there is a class available, as you can read beneath:
VB.NET:
Public Function GenerateHash(ByVal SourceText As String) As String
'Create an encoding object to ensure the encoding standard for the source text
Dim Ue As New UnicodeEncoding
'Retrieve a byte array based on the source text
Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)
'Instantiate an MD5 Provider object
Dim Md5 As New MD5CryptoServiceProvider
'Compute the hash value from the source
Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
Return ByteHash.ToString
End Function
But, this code returns something that has maybe the same length of an MD5 hash, but surely does not look like one (containing e.g. these characters: =,T, O, Q, etc.). This is not possible for an MD5 since MD5 is always in hexadecimal characters...
How solve this?
Thanks