Feedback

VB - Den MD5 Hash eines Strings ermitteln

Veröffentlicht von am 6/3/2006
(1 Bewertungen)
Den MD5 Hash eines Strings ermitteln
Imports System.Security.Cryptography
Imports System.Text

Public Function MD5StringHash(ByVal strString As String) As String
    Dim MD5 As New MD5CryptoServiceProvider
    Dim Data As Byte()
    Dim Result As Byte()
    Dim Res As String = ""
    Dim Tmp As String = ""

    Data = Encoding.ASCII.GetBytes(strString)
    Result = MD5.ComputeHash(Data)
    For i As Integer = 0 To Result.Length - 1
        Tmp = Hex(Result(i))
        If Len(Tmp) = 1 Then Tmp = "0" & Tmp
        Res += Tmp
    Next
    Return Res
End Function
Abgelegt unter MD5, String, Hash.

Kommentare zum Snippet

 

Logge dich ein, um hier zu kommentieren!