Function Encrypt(ByVal StrPW As String) As String
Dim MD5 As New MD5CryptoServiceProvider()
Dim data() As Byte = Encoding.ASCII.GetBytes(StrPW)
Dim encryptedData() As Byte = MD5.ComputeHash(data)
Return Convert.ToBase64String(encryptedData)
End Function
Imports System.Security.Cryptography
Imports System.Text
Public Function MD5(ByVal strString As String) As String
Dim ASCIIenc As New ASCIIEncoding
Dim strReturn As String
Dim ByteSourceText() As Byte = ASCIIenc.GetBytes(strString)
Dim Md5Hash As New MD5CryptoServiceProvider
Dim ByteHash() As Byte = Md5Hash.ComputeHash(ByteSourceText)
For Each b As Byte In ByteHash
strReturn = strReturn & b.ToString("x2")
Next
Return strReturn
End Function