MD5 File Hash einer Datei ermitteln

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Hier werde ich euch zeigen, wie ihr den MD5FileHasch einer Datei ermitteln könnt.

    Source Code

    1. Option Explicit On
    2. Imports System.IO
    3. Imports System.Net
    4. Imports System.Security.Cryptography
    5. Public Function MD5FileHash(ByVal sFile As String) As String
    6. Dim MD5 As New MD5CryptoServiceProvider
    7. Dim Hash As Byte()
    8. Dim Result As String = ""
    9. Dim Tmp As String = ""
    10. Dim FN As New FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
    11. MD5.ComputeHash(FN)
    12. FN.Close()
    13. Hash = MD5.Hash
    14. For i As Integer = 0 To Hash.Length - 1
    15. Tmp = Hex(Hash(i))
    16. If Len(Tmp) = 1 Then Tmp = "0" & Tmp
    17. Result += Tmp
    18. Next
    19. Return Result
    20. End Function
    Display All



    Wie kann ich den Code verwenden??

    Source Code

    1. tbOutput.Text = MD5FileHash(tbEingang.Text)



    Viel Spaß weiterhin mit dem Code

    3,735 times viewed