Public Shared
Function GetMD5Hash
(ByVal str As String) As String
Try
Dim MD5Hasher
As New MD5CryptoServiceProvider
Dim rawBytes
As Byte() = ASCIIEncoding.
ASCII.
GetBytes(str)
Dim myHash
As Byte() = MD5Hasher.
ComputeHash(rawBytes
)
Dim myCapacity
As Integer = Convert.
ToInt32(((myHash.
Length *
2) +
(myHash.
Length /
8)))
Dim sb
As System.
Text.
StringBuilder =
New System.
Text.
StringBuilder(myCapacity
)
For i
As Integer =
0 To myHash.
Length -
1
sb.
Append(BitConverter.
ToString(myHash, i,
1))
Next
Return sb.
ToString().
TrimEnd(New Char
() {" "c
}).
ToLower
Catch ex
As Exception
Debug.
WriteLine(ex.
ToString)
Return
"Error occured."
End Try
End Function