/ Published in: VB.NET

This function accepts a string and converts it to its corresponding 32 bit hexadecimal MD5 hash. It comes in handy for encrypting passwords and keys.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Public Shared Function getMD5Hash(ByVal strToHash As String) As String Dim md5Obj As New System.Security.Cryptography.MD5CryptoServiceProvider() Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash) bytesToHash = md5Obj.ComputeHash(bytesToHash) Dim strResult As String = "" Dim b As Byte For Each b In bytesToHash strResult += b.ToString("x2") Next Return strResult End Function
Comments
