<?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>Haiders WebSpace &#187; Hash Function</title>
	<atom:link href="http://blog.creativeitp.com/tag/hash-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.creativeitp.com</link>
	<description>Let&#039;s talk about IT</description>
	<lastBuildDate>Sat, 27 Feb 2010 13:15:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MD5 checksums to verify files integrity</title>
		<link>http://blog.creativeitp.com/posts-and-articles/cryptography/md5-checksums-to-verify-files-integrity/</link>
		<comments>http://blog.creativeitp.com/posts-and-articles/cryptography/md5-checksums-to-verify-files-integrity/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 19:59:57 +0000</pubDate>
		<dc:creator>Haider al-Khateeb</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Hash Function]]></category>

		<guid isPermaLink="false">http://blog.creativeitp.com/?p=204</guid>
		<description><![CDATA[MD5 (Message-Digest algorithm 5) can be used effectively to verify files integrity and authenticity by computing and checking MD5 hashes. In Windows: MD5summer can be used to perform the task. While in Linux: The famous md5sum utility is usually used. The following examples shows how md5sum can be used from the command line. To compute [...]]]></description>
			<content:encoded><![CDATA[<p>MD5 (Message-Digest algorithm 5) can be used effectively to verify files integrity and authenticity by computing and checking MD5 hashes.</p>
<p>In Windows: <a href="http://www.md5summer.org" target="_blank">MD5summer</a> can be used to perform the task.</p>
<p>While in Linux: The famous <a href="http://manpages.ubuntu.com/manpages/lucid/en/man1/md5sum.1.html" target="_blank">md5sum</a> utility is usually used.</p>
<p> <span id="more-204"></span><br />
The following examples shows how <b>md5sum</b> can be used from the command line.</p>
<p>To compute the MD5 sum of an ISO file for example use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">md5sum filename.iso</pre></div></div>

<p>The result will be something like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">f8c7451b0de5a1e5f7a68fb3d15f4064 filename.zip</pre></div></div>

<p>Note that the wild card can be used too, so if you are in a folder containing many files, you can compute the hashes to all files using:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">md5sum <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">md5sum h<span style="color: #000000; font-weight: bold;">*</span>.exe</pre></div></div>

<p>Some applications/distributions provide a file with all MD5 hashes of the released files. Ubuntu for example provide a file called MD5SUMS and it looks like this from inside:</p>
<p><b><br />
836440698456aa2936a4347b5485fdd6 *ubuntu-9.10-alternate-amd64.iso<br />
3faa345d298deec3854e0e02410973dc *ubuntu-9.10-alternate-i386.iso<br />
dc51c1d7e3e173dcab4e0b9ad2be2bbf *ubuntu-9.10-desktop-amd64.iso<br />
d91659de6e945dbb96eb8970b2b4590a *ubuntu-9.10-desktop-armel+dove.img<br />
297875d2a7531824a0fb08f241d33e85 *ubuntu-9.10-desktop-armel+imx51.img<br />
8790491bfa9d00f283ed9dd2d77b3906 *ubuntu-9.10-desktop-i386.iso<br />
ed6e77587b87fe0d92a2f21855869f00 *ubuntu-9.10-netbook-remix-i386.iso<br />
14707e8847b9c9ba2dd1869fb5086e4f *ubuntu-9.10-server-amd64.iso<br />
55618ad5f180692f9dac20cbff352634 *ubuntu-9.10-server-i386.iso<br />
37a04db193b1a342f961f59aea2fada8 *wubi.exe<br />
</b></p>
<p>Now assume you downloaded: ubuntu-9.10-alternate-i386.iso<br />
You can verify it&#8217;s hash against that list with the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">md5sum ubuntu-<span style="color: #000000;">9.10</span>-alternate-i386.iso <span style="color: #660033;">-c</span> MD5SUMS</pre></div></div>

<p>If the comparison results in a single match then your file is alright.</p>
<p>To cultivate the result, use the following to show the positive match only:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">md5sum ubuntu-<span style="color: #000000;">9.10</span>-alternate-i386.iso <span style="color: #660033;">-c</span> MD5SUMS <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;FAILED$&quot;</span></pre></div></div>

<p><b>grep -v &#8220;FAILED$&#8221;</b> is used to ignore the failed comparisons in the results, hence, if we change it to <b>grep -v &#8220;OK$&#8221;</b> we can get the failed comparisons only. this is useful when you run md5sum to verify many files against a list and need to check if there are any bad files.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.creativeitp.com/posts-and-articles/cryptography/md5-checksums-to-verify-files-integrity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
