写全命名空间
Public Function GetMd5(ByVal md5str As String, ByVal Type As Integer) As String
If Type = 16 Then
Dim algorithm As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
Dim data As Byte() = algorithm.ComputeHash(Encoding.UTF8.GetBytes(md5str))
Dim sh1 As String = ""
For i As Integer = 0 To data.Length - 1
sh1 += data(i).ToString("x2").ToUpperInvariant()
Next
Return sh1.Substring(8, 16).ToLower()
ElseIf Type = 32 Then
Dim algorithm As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
Dim data As Byte() = algorithm.ComputeHash(Encoding.UTF8.GetBytes(md5str))
Dim sh1 As String = ""
For i As Integer = 0 To data.Length - 1
sh1 += data(i).ToString("x2").ToUpperInvariant()
Next
Return sh1.ToLower()
End If
Return ""
End Function