<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual C++ Tips &#187; file checksum</title>
	<atom:link href="http://weseetips.com/tag/file-checksum/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com</link>
	<description>Gold mine of Visual C++ tricks!</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>How to calculate the checksum of data?</title>
		<link>http://weseetips.com/2008/08/05/how-to-calculate-the-checksum-of-data/</link>
		<comments>http://weseetips.com/2008/08/05/how-to-calculate-the-checksum-of-data/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 17:33:58 +0000</pubDate>
		<dc:creator>Jijo Raj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[calcualte checksum]]></category>
		<category><![CDATA[checksum]]></category>
		<category><![CDATA[checksum error]]></category>
		<category><![CDATA[checksum of executable]]></category>
		<category><![CDATA[CheckSumMappedFile()]]></category>
		<category><![CDATA[compute checksum]]></category>
		<category><![CDATA[file checksum]]></category>
		<category><![CDATA[generate checksum]]></category>
		<category><![CDATA[PIMAGE_NT_HEADERS]]></category>

		<guid isPermaLink="false">http://weseetips.wordpress.com/?p=308</guid>
		<description><![CDATA[Long back, I own a Cyrix machine and periodically it stops booting by showing the message &#8211; &#8220;Checksum failure&#8220;. I still remember those long beeps. Well, Checksum is digest generated from a long data which can be used to check the integrity of data. For instance, if you want to know whether your data file [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-11" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /></p>
<p><span style="color:#0000ff;">Long back, I own a <strong>Cyrix machine</strong></span> and <span style="color:#0000ff;">periodically it stops booting by showing the message</span> &#8211; &#8220;<span style="color:#0000ff;">Checksum failure</span>&#8220;. I still remember those <span style="color:#0000ff;">long beeps</span>. <img src='http://weseetips.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Well, <span style="color:#0000ff;">Checksum is digest generated</span> from a long data which can be used to <span style="color:#0000ff;">check the integrity of data</span>.</p>
<p><img class="alignnone size-full wp-image-313" src="http://siteground205.com/~weseetip/wp-content/uploads/2008/08/checksum.jpg" alt="" width="500" height="407" /></p>
<p>For instance, if you want to know whether your data file is corrupted, generate and keep the checksum and afterwards for verification again generate the checksum and compare. <span style="color:#0000ff;">So how to generate the checksum?</span></p>
<p><img class="alignnone size-medium wp-image-12" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /><br />
You can use the function &#8211; <span style="color:#0000ff;">CheckSumMappedFile()</span>. <span style="color:#0000ff;">Actually its used to calculate the checksum of mapped file.</span> Well, you <span style="color:#0000ff;">can use it to calculate the checksum of your data too!</span> Just see the code snippet.</p>
<pre>// The data.
char* pString = "Hello";
DWORD HeaderSum = 0;
DWORD Checksum = 0;

// Calculate the checksum.
CheckSumMappedFile( pString,
                    strlen( pString),
                    &amp;HeaderSum,
                    &amp;Checksum );</pre>
<p><img class="alignnone size-medium wp-image-18" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
The <span style="color:#0000ff;">return of the function</span> is <span style="color:#0000ff;">PIMAGE_NT_HEADERS</span> and in this case, it will be 0 and<span style="color:#0000ff;"> just ignore it.</span> Since our data provided is <span style="color:#0000ff;">not a valid PE file, its obvious</span>. If you check the <span style="color:#0000ff;">Checksum variable,</span> you can find it contains a <span style="color:#0000ff;">valid checksum always</span>. So Take care!</p>
<p><img class="alignnone size-medium wp-image-53" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" alt="" width="248" height="32" /><br />
Targeted Audience &#8211; Intermediate.</p>
]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/08/05/how-to-calculate-the-checksum-of-data/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

