Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/MD5/Visual-Basic-.NET/md5.vb
Normal file
25
Task/MD5/Visual-Basic-.NET/md5.vb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Imports System.Security.Cryptography
|
||||
Imports System.Text
|
||||
|
||||
Module MD5hash
|
||||
Sub Main(args As String())
|
||||
Console.WriteLine(GetMD5("Visual Basic .Net"))
|
||||
End Sub
|
||||
|
||||
Private Function GetMD5(plainText As String) As String
|
||||
Dim hash As String = ""
|
||||
|
||||
Using hashObject As MD5 = MD5.Create()
|
||||
Dim ptBytes As Byte() = hashObject.ComputeHash(Encoding.UTF8.GetBytes(plainText))
|
||||
Dim hashBuilder As New StringBuilder
|
||||
|
||||
For i As Integer = 0 To ptBytes.Length - 1
|
||||
hashBuilder.Append(ptBytes(i).ToString("X2"))
|
||||
Next
|
||||
hash = hashBuilder.ToString
|
||||
End Using
|
||||
|
||||
Return hash
|
||||
End Function
|
||||
|
||||
End Module
|
||||
Loading…
Add table
Add a link
Reference in a new issue