新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
剖析VB.NETMD5加密字符串實(shí)現(xiàn)過程
網(wǎng)絡(luò)其實(shí)有的時(shí)候不是很安全,在傳輸?shù)倪^成中可能受到攻擊,在這里我為大家講解 VB.NET MD5加密字符串的實(shí)現(xiàn)方法,大家可以試試。

10年積累的成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計(jì)制作后付款的網(wǎng)站建設(shè)流程,更有孟州免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
VB.NET MD5加密字符串的實(shí)現(xiàn)方法
- Imports System.Text
- Imports System.Security.Cryptography
- Public Class Form1Class Form1
- Inherits System.Windows.Forms.Form
- #Region " Windows 窗體設(shè)計(jì)器生成的代碼 "
- Public Sub New()Sub New()
- MyBase.New()
- '該調(diào)用是 Windows 窗體設(shè)計(jì)器所必需的。
- InitializeComponent()
- '在 InitializeComponent() 調(diào)用之后添加任何初始化
- End Sub
- '窗體重寫 dispose 以清理組件列表。
- Protected Overloads Overrides Sub Dispose()Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- 'Windows 窗體設(shè)計(jì)器所必需的
- Private components As System.ComponentModel.IContainer
- '注意: 以下過程是 Windows 窗體設(shè)計(jì)器所必需的
- '可以使用 Windows 窗體設(shè)計(jì)器修改此過程。
- '不要使用代碼編輯器修改它。
- Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
- Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
- Friend WithEvents Button1 As System.Windows.Forms.Button
()> Private Sub InitializeComponent()Sub InitializeComponent() - Me.TextBox1 = New System.Windows.Forms.TextBox
- Me.TextBox2 = New System.Windows.Forms.TextBox
- Me.Button1 = New System.Windows.Forms.Button
- Me.SuspendLayout()
- '
- 'TextBox1
- '
- Me.TextBox1.Location = New System.Drawing.Point(32, 56)
- Me.TextBox1.Name = "TextBox1"
- Me.TextBox1.Size = New System.Drawing.Size(144, 21)
- Me.TextBox1.TabIndex = 0
- Me.TextBox1.Text = ""
- '
- 'TextBox2
- '
- Me.TextBox2.Location = New System.Drawing.Point(32, 96)
- Me.TextBox2.Name = "TextBox2"
- Me.TextBox2.Size = New System.Drawing.Size(224, 21)
- Me.TextBox2.TabIndex = 1
- Me.TextBox2.Text = ""
- '
- 'Button1
- '
- Me.Button1.Location = New System.Drawing.Point(184, 56)
- Me.Button1.Name = "Button1"
- Me.Button1.TabIndex = 2
- Me.Button1.Text = "Button1"
- '
- 'Form1
- 'Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(472, 285)
- Me.Controls.Add(Me.Button1)
- Me.Controls.Add(Me.TextBox2)
- Me.Controls.Add(Me.TextBox1)
- Me.Name = "Form1"
- Me.Text = "MD5"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim md5 As New MD5CryptoServiceProvider
- Dim username As Byte() = (New ASCIIEncoding).GetBytes(TextBox1.Text)
- '轉(zhuǎn)換為哈希值Byte數(shù)組
- Dim mdByte As Byte() = md5.ComputeHash(username)
- 'Dim mdString As String = System.BitConverter.ToString(mdByte)
- Dim mdString As String = (New ASCIIEncoding).GetString(mdByte)
- TextBox2.Text = mdString
- End Sub
- Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- End Class
System.Security.Cryptography這個(gè)類需要引用,它提供了安全方面的服務(wù),用于MD5只是它的一個(gè)毛皮功夫。以上是有關(guān)VB.NET MD5加密字符串的實(shí)現(xiàn)方法的一個(gè)演示,不是很難吧。
【編輯推薦】
- 剖析VB.NET平臺調(diào)用是如何執(zhí)行操作
- 分享個(gè)人總結(jié)VB.NET多線程
- 詳細(xì)說明VB.NET變量中四點(diǎn)
- 三類十二種VB.NET數(shù)據(jù)類型全面介紹
- VB.NET初步知識,初學(xué)者必看
當(dāng)前文章:剖析VB.NETMD5加密字符串實(shí)現(xiàn)過程
網(wǎng)站URL:http://m.fisionsoft.com.cn/article/dpodgce.html


咨詢
建站咨詢
