<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Calculating CRC-32 in C# and .NET</title>
	<atom:link href="http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/feed" rel="self" type="application/rss+xml" />
	<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net</link>
	<description>A .NET developer in Redmond</description>
	<pubDate>Tue, 06 Jan 2009 09:47:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Alessio</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-10410</link>
		<dc:creator>Alessio</dc:creator>
		<pubDate>Tue, 25 Nov 2008 11:27:34 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-10410</guid>
		<description>Hi,
I tried to execute the program under Windows XP and the CRC-hash calculated for a file of 25MB wasn't correct, just because of in windows XP the CalculateHash was called more than once(it works with a lenght of 4096 byte at a time). I toke off the '~' from "return ~crc" of CalculateHash and put it on "byte[] hashBuffer = UInt32ToBigEndianBytes(~hash)" of HashFinal, so that step was made only once at the end of cycle (without modifying the intermediate values).
In this way the algorithm worked corrctly.

I hope I gived a hand,
Alessio</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I tried to execute the program under Windows XP and the CRC-hash calculated for a file of 25MB wasn't correct, just because of in windows XP the CalculateHash was called more than once(it works with a lenght of 4096 byte at a time). I toke off the '~' from "return ~crc" of CalculateHash and put it on "byte[] hashBuffer = UInt32ToBigEndianBytes(~hash)" of HashFinal, so that step was made only once at the end of cycle (without modifying the intermediate values).<br />
In this way the algorithm worked corrctly.</p>
<p>I hope I gived a hand,<br />
Alessio</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stefan</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-9146</link>
		<dc:creator>stefan</dc:creator>
		<pubDate>Fri, 15 Aug 2008 15:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-9146</guid>
		<description>Did you fix the error in your code now? I would like to use it, with files longer than 4096 bytes.</description>
		<content:encoded><![CDATA[<p>Did you fix the error in your code now? I would like to use it, with files longer than 4096 bytes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damien Guard</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-6461</link>
		<dc:creator>Damien Guard</dc:creator>
		<pubDate>Thu, 28 Feb 2008 13:43:44 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-6461</guid>
		<description>You're right, multiple calls to HashCore will carry on from the final complement instead of the actual current hash value.

Removing the ~ complement from the CalculateHash function means you can't use that static method directly... I think complementing it in Initialize and inside HashCore might be a better approach.

Will update the code once I've had chance to test it and check the other hashing algorithms I have up.

Thanks!

[)amien</description>
		<content:encoded><![CDATA[<p>You're right, multiple calls to HashCore will carry on from the final complement instead of the actual current hash value.</p>
<p>Removing the ~ complement from the CalculateHash function means you can't use that static method directly... I think complementing it in Initialize and inside HashCore might be a better approach.</p>
<p>Will update the code once I've had chance to test it and check the other hashing algorithms I have up.</p>
<p>Thanks!</p>
<p>[)amien</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mario</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-6460</link>
		<dc:creator>Mario</dc:creator>
		<pubDate>Thu, 28 Feb 2008 13:26:37 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-6460</guid>
		<description>Nice code, but i found a bug if you compute values for streams larger than 4096 bytes (make textfile in sample code larger than 4096). In this case the HashCore function is called more than once but the complement is build in the CalculateHash function. So you don't get the complement for the final value but for each intermediate value which will result in a wrong value. The complement build should take place in the HashFinal function.</description>
		<content:encoded><![CDATA[<p>Nice code, but i found a bug if you compute values for streams larger than 4096 bytes (make textfile in sample code larger than 4096). In this case the HashCore function is called more than once but the complement is build in the CalculateHash function. So you don't get the complement for the final value but for each intermediate value which will result in a wrong value. The complement build should take place in the HashFinal function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-5770</link>
		<dc:creator>Gaurav</dc:creator>
		<pubDate>Tue, 01 Jan 2008 16:30:26 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-5770</guid>
		<description>]Dude, thanks a lot, i found a lot of dumb code out there and this is the best code written for this purpose.

I wrote one my self but it was a conversion from Java to c# and i did not use at least some support which c# provides and there was some other code which generated wrong checksomes on a 64-bit processor.
Although i have not tested your code on 64 bit processor but it seems it should work fine as far as my knowledge is concerned.</description>
		<content:encoded><![CDATA[<p>]Dude, thanks a lot, i found a lot of dumb code out there and this is the best code written for this purpose.</p>
<p>I wrote one my self but it was a conversion from Java to c# and i did not use at least some support which c# provides and there was some other code which generated wrong checksomes on a 64-bit processor.<br />
Although i have not tested your code on 64 bit processor but it seems it should work fine as far as my knowledge is concerned.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Calculating CRC-64 in C# and .NET &#187; DamienG</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-5195</link>
		<dc:creator>Calculating CRC-64 in C# and .NET &#187; DamienG</dc:creator>
		<pubDate>Mon, 19 Nov 2007 12:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-5195</guid>
		<description>[...] how the CRC-32 C# class I posted some time ago continues to get lots of Google hits I thought I'd post a CRC-64 version which will no doubt be far [...]</description>
		<content:encoded><![CDATA[<p>[...] how the CRC-32 C# class I posted some time ago continues to get lots of Google hits I thought I'd post a CRC-64 version which will no doubt be far [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damien Guard</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-1547</link>
		<dc:creator>Damien Guard</dc:creator>
		<pubDate>Sun, 29 Oct 2006 11:40:37 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-1547</guid>
		<description>Updated to include usage sample.

[)amien</description>
		<content:encoded><![CDATA[<p>Updated to include usage sample.</p>
<p>[)amien</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronak</title>
		<link>http://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net/comment-page-1#comment-1546</link>
		<dc:creator>Ronak</dc:creator>
		<pubDate>Sat, 28 Oct 2006 08:14:41 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/blog/archive/2006/08/08/calculating_crc32_in_c_and_net.aspx#comment-1546</guid>
		<description>But how do i use it in the Actual Code.&lt;br /&gt;I want to calculate CRC of file...&lt;br /&gt;How can i use this code to do it</description>
		<content:encoded><![CDATA[<p>But how do i use it in the Actual Code.<br />I want to calculate CRC of file...<br />How can i use this code to do it</p>
]]></content:encoded>
	</item>
</channel>
</rss>
