VB.NET 2008 获取MD5加密

it2022-05-09  24

1 Imports System.Text 2 Imports System.Security.Cryptography 3 4 Function getMD5Hash(ByVal strToHash As String) As String 5 Dim md5Obj As New Security.Cryptography.MD5CryptoServiceProvider 6 Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash) 7 bytesToHash = md5Obj.ComputeHash(bytesToHash) 8 Dim strResult As String = "" 9 For Each b As Byte In bytesToHash10 strResult += b.ToString("x2")11 Next12 Return strResult13 End Function 14 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click15 If txtmm.Text <> "" Then16 txtmd5.Text = getMD5Hash(txtmm.Text)17 End If18 End Sub

 

转载于:https://www.cnblogs.com/imlions/archive/2012/02/05/vbnet-md5.html

相关资源:VB.net中两种方法实现MD5加密

最新回复(0)