How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?
This guy seems to have your answer.
https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net
And in case the blog ever goes away or breaks the url, here's the github link:
https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs
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);
1.4m articles
1.4m replys
5 comments
57.0k users