[求助]如何实现在VB.NET中进行MD5加密和解密,不知道那个做个,能告诉怎么写吗?
谢谢了,
Imports System.Security.Cryptography
Function MD5(ByVal input As String, ByVal coda As Integer) As String
Dim md5Hasher As New MD5CryptoServiceProvider
Dim data As Byte() = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input))
Dim sBuilder As New StringBuilder
Dim i As Integer
If coda = 16 Then
For i = 4 To 11
sBuilder.Append(data(i).ToString("x2"))
Next i
Else
For i = 0 To 15
sBuilder.Append(data(i).ToString("x2"))
Next i
End If
Return sBuilder.ToString()
End Function
msgbox (md5("想要加密的字符串",16)) '返回16位的密文
msgbox (md5("想要加密的字符串",32)) '返回32位的密文