Den SHA1 Hash eines Strings ermitteln
Imports System.Security.Cryptography
Imports System.Text
Public Function SHA1StringHash(ByVal strString As String) As String
Dim SHA1 As New SHA1CryptoServiceProvider
Dim Data As Byte()
Dim Result As Byte()
Dim Res As String = ""
Dim Tmp As String = ""
Data = Encoding.ASCII.GetBytes(strString)
Result = SHA1.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
Kommentare zum Snippet