How do I calculate CRC32 of a string

This guy seems to have your answer.

And in case the blog ever goes away or breaks the url, here’s the github link:

Usage of the Crc32 class from the blog post:

Crc32 crc32 = new Crc32();
String hash = String.Empty;

using (FileStream fs = File.Open("c:\\myfile.txt", FileMode.Open))
  foreach (byte b in crc32.ComputeHash(fs)) hash += b.ToString("x2").ToLower();

Console.WriteLine("CRC-32 is {0}", hash);

Leave a Comment