Groups | Blog | Home
all groups > c# > june 2005 >

c# : CRC .NET


Larry
6/8/2005 11:34:15 PM
Hello,
Is there a framework class that implements CRC 32 algorithms. I could not
find on msdn, I just want to make sure that I didn't miss it.
If not can anyone explain how CRC32 algorithm can be implemented.

Thank you



William Stacey [MVP]
6/9/2005 1:54:42 AM
I would use SHA1.ComputeHash(stream).

--
William Stacey [MVP]

[quoted text, click to view]

Jon Skeet [C# MVP]
6/9/2005 6:49:12 AM
[quoted text, click to view]

There are plenty of sample implementations around on the web, including
ones in C#.

Do a google search for crc32 and C#, and you'll find lots.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
Jon Skeet [C# MVP]
6/9/2005 7:20:01 AM
[quoted text, click to view]

It depends on what the requirement is. If it's just "a hashing
algorithm" then SHA1 would indeed be a pretty good choice - but there
are other hashes which are cheaper to calculate but still good at
preventing *accidental* corruption (rather than deliberate tampering).
Adler32 is better than CRC32 in this respect, I believe.

However, my guess is that the OP actually needs to work out a CRC32
hash to match something else which is already working out a CRC32
hash...

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
William Stacey [MVP]
6/9/2005 9:53:43 AM
If Larry still needs some CRC32, I posted a small sample project at:
http://spaces.msn.com/members/staceyw/Blog/cns!1pnsZpX0fPvDxLKC6rAAhLsQ!402.entry

--
William Stacey [MVP]

[quoted text, click to view]

Larry
6/9/2005 8:04:28 PM
Thanks. I also found good resources and code on the web. They all produce
identical CRC32 chechsum. Thanks.


[quoted text, click to view]

AddThis Social Bookmark Button