c#

Hash Large Files with .Net SHA1/MD5

I've been working on an application that checks for duplicate files.  One of the better ways to test whether files are identical is to hash them.  MD5 hashing is common, but it has been known to cause collisions.  I elected to use the SHA1 algorithm instead.

In my testing, I've found that I can has a ~1GB file within about 7 seconds without consuming an equal share of memory.

You will need the following namespaces:

  • System.Security.Cryptography
  • System.IO

SHA1 Hash Example Code:

Syndicate content