Hash for the holidays [Managed implementation of CRC32 and MD5 algorithms updated; new release of ComputeFileHashes for Silverlight, WPF, and the command-line!]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments (4)
  1. Cracked says:

    Why use MD5 anymore Fed Requires SHA2 based algorithms….  cracked

  2. David Anson says:


    Some scenarios don't care about the possibility of someone introducing a collision; for example when hashing local files to quickly identify duplicates. Similarly, some communication protocols require MD5; for example, HTTP's digest access authentication: en.wikipedia.org/…/Digest_access_authentication

    I'm all for using the strongest algorithm possible – it's just that sometimes it's not necessary – or possible. 🙂

  3. Richard says:

    Your CRC32 class has a static constructor with the comment:

    "Table values must be computed; not possible to remove the static constructor."

    Of course it is – just create a private static function to build the table and assign it inline:

    private static readonly uint[] _crc32Table = BuildTable();

    private static uint[] BuildTable()


       uint[] result = new uint[256];


       return result;


  4. David Anson says:


    Neat, thanks – I'm not sure I knew about that! 🙂 As it happens, I don't think the code is really any better/worse for this because the same thing ends up happening at runtime either way. But because I generally prefer to address code analysis warnings (vs. suppressing them), I'll definitely keep this in mind.

    Thanks very much!

Comments are closed.

Skip to main content