Imports System.Text
Imports System.Security.Cryptography
Private Function GenerateHash(ByVal SourceText As String) As String
Dim Ue As New UnicodeEncoding()
Dim ByteSourceText() As Byte = Ue.GetBytes(SourceTStext)
Dim Md5 As New MD5CryptoServiceProvider()
Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
Return Convert.ToBase64String(ByteHash)
End Function This function will get the MD5 hash of a string.
Usage:
MsgBox(GenerateHash("BLA BLA BLA"))
No comments:
Post a Comment