Menu

FileHash

Help
krazymike
2008-06-30
2013-04-12
  • krazymike

    krazymike - 2008-06-30

    I'm trying to get an MD5 and SHA1 of a file, but I can't seem to get it working.  My code's a mess, so if anyone can just post a simple way to get this done, I'll adapt it to my app.

    Thanks.

     
    • Kelly Ethridge

      Kelly Ethridge - 2008-06-30

      Hello krazymike,

      Here is a simple way of computing the hash of a file:

      Dim Hasher As New MD5CryptoServiceProvider
      Dim Hash() As Byte
      Hash = Hasher.ComputeHash(File.OpenFile("MyFile.txt", OpenExisting))

      This is basically a copy from the forums found at www.kellyethridge.com/vbcorlib

      Hope this helps!
      Kelly

       

Log in to post a comment.