Public Function Md5(ByVal code As String) Dim _md5 As String = "" Dim dataToHash As Byte() = (New System.Text.ASCIIEncoding).GetBytes(code) Dim hashvalue As Byte() = CType(System.Security.Cryptography.CryptoConfig.CreateFromName("MD5"), System.Security.Cryptography.HashAlgorithm).ComputeHash(dataToHash) Dim i As Integer For i = 0 To 15 '选择32位字符的加密结果 _md5 += Hex(hashvalue(i)).ToLower Next Return _md5 End Function