Matthew ".NET 247" Reynolds

Matthew Reynolds... software development consultant, author, speaker and trainer

CRC32 check for .NET

You know, I remember I time when it was uncommon to find .NET implementations of useful code.

CRC, Cyclic Redundancy Check (and not Class, Responsibility, Collaboration, see XP) is useful for discovering whether changes have been made to a collection of bytes.  CRC creates a signature for a collection of bytes, and there's a very low chance that two collections will have the same CRC signature.  (This is true for even minor changes to a file.)

The guys at vbAccelerator have a CRC library for .NET, if anyone else out there needs one of these today.  Check out the rest of their libraries for more cool bits and pieces.

Comments

Tone Engel said:

You can also use the MD5 hash:

The following example computes the MD5 hash for data and stores it in result. This example assumes that there is a predefined constant DATA_SIZE.

byte[] data = new byte[DATA_SIZE];

// This is one implementation of the abstract class MD5.
MD5 md5 = new MD5CryptoServiceProvider();

byte[] result = md5.ComputeHash(data);
# October 15, 2003 11:33 AM