Geek Posted February 5, 2012 Posted February 5, 2012 <div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2012/02/check-sha1-hash.jpg" alt="Check SHA1 Hash Checksum in Mac OS X" title="check-sha1-hash" width="620" height="136" class="aligncenter size-full wp-image-26873" /></p> <p>SHA hashing is frequently used with distribution control systems to determine revisions and to check data integrity by detecting file corruption or tampering. For common usage, a SHA checksum provides a string that can be used to verify a file been transferred as intended. If SHA checksums match, the files integrity has been maintained.</p> <h2 style="font-size:1.2em;">Checking SHA1 Hash in Mac OS X</h2> <p>Launch the Terminal, found within the Applications and Utilities folder, and use the following syntax:</p> <p><code>shasum /path/to/file</code></p> <p>To verify a file named “DownloadedFile.dmg” on the desktop, it would be:</p> <p><code>shasum ~/Desktop/DownloadedFile.dmg</code></p> <p>This will output something like this:</p> <p><code>$ shasum ~/Desktop/CheckMe.zip ddfdb3a7fc6fc7ca714c9e2930fa685136e90448 CheckMe.zip</code></p> <p>That long hexadecimal string is the SHA1 hash.</p> <p>An easy way to check SHA1 files buried deep in the file system without typing out the full path, is to type the first part of the command then drag and drop the file into the Terminal window. This <a href="http://osxdaily.com/2011/03/02/drag-drop-finder-items-into-the-terminal-for-their-full-path/">automatically types the path</a> for you:</p> <p><code>shasum (drag and drop file here)</code></p> <p>Remember to put a space after “shasum” for this to work properly.</p> <p>The default for the shasum command is to use SHA1, the most common hash type, but this can be changed with the -a flag if necessary to 224, 256, 384, or 512. Also, though SHA1 is becoming more common than MD5, you can still <a href="http://osxdaily.com/2009/10/13/check-md5-hash-on-your-mac/">easily check md5 hash</a> in Mac OS X as well with the md5 command.</p> <h2 style="font-size:1.1em;">Examples of Using SHA1 to Verify Files</h2> <p>A practical use that Mac users may encounter is when downloading software updates directly from Apple, who lists the SHA1 hash of each file offered through their servers at the end of each downloads page. You can see such a string highlighted in the screenshot below. This string allows users to easily verify the integrity of their downloads either from Apple or when the file has been hosted on a third party mirror site. </p> <p><img src="http://osxdaily.com/wp-content/uploads/2012/02/sha1-on-apple-downloads.jpg" alt="SHA1 Checksum on Apple Downloads Page" title="sha1-on-apple-downloads" width="620" height="358" class="aligncenter size-full wp-image-26871" /></p> <p>This is also how it was discovered that <a href="http://osxdaily.com/2012/02/04/mac-os-x-10-7-3-combo-silently-updated/">OS X 10.7.3 had been quietly updated</a>, and several questions about this spawned this post.</p> <p>Using SHA1 hash strings are also an easy way to verify file transfers from peer to peer networks and to make sure a download has finished, or that a file was not tampered with somewhere along the line. By knowing the origin SHA1 checksum, you can verify your version of the file(s) in question matches, and determine if the file is indeed valid and has arrived as intended.</p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/WxbflbJKMe78WCBHBbOdsyWlkkQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/WxbflbJKMe78WCBHBbOdsyWlkkQ/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/WxbflbJKMe78WCBHBbOdsyWlkkQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/WxbflbJKMe78WCBHBbOdsyWlkkQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=83yJdFei_6M:2zhCAVn7D4Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=83yJdFei_6M:2zhCAVn7D4Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=83yJdFei_6M:2zhCAVn7D4Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=83yJdFei_6M:2zhCAVn7D4Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=83yJdFei_6M:2zhCAVn7D4Y:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=83yJdFei_6M:2zhCAVn7D4Y:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=83yJdFei_6M:2zhCAVn7D4Y:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/83yJdFei_6M" height="1" width="1"/> View the full article
Recommended Posts