|
|
Applescript droplet to get the SHA1 checksum
I know this is not AppleScript, but if there are those that want a quick and easy compare and if you're a Terminal fan, I use this code in my $HOME/.bashrc file:
cksha1 ()
{
if [ $# -lt 2 ] ; then
echo "Usage: cksha1 filepath sha1-sum ..." ;
echo " must specify at least one pair of file and checksum." ;
echo "Exiting." ;
fi
filesha1=`/usr/bin/openssl sha1 $1 | /usr/bin/awk -F"=" '{ print $2 }'` ;
if [ $filesha1 == $2 ] ; then
echo "** SHA1 matches **" ;
else
echo " ********** ERROR: SHA1 DOES NOT MATCH **********" ; fi
}
This lets me copy the checksum from the web page where they list it and do the following in Terminal: $ cksha1 ~/Desktop/Inbox/GoogleChrome.dmg e90cc5b126544dfa9a264a105d49a1824fb8786d ** SHA1 matches ** You can easily do the same for the other common digest format: MD5
ckmd5 ()
{
if [ $# -lt 2 ] ; then
echo "Usage: ckmd5 filepath md5sum ..." ;
echo " must specify at least one pair of file and checksum." ;
echo "Exiting." ;
fi
filemd5=`/usr/bin/openssl md5 $1 | /usr/bin/awk -F"=" '{ print $2 }'` ;
if [ $filemd5 == $2 ] ; then
echo "** MD5 matches **" ;
else
echo " ********** ERROR: MD5 DOES NOT MATCH **********" ; fi
}
With the same sort of results:$ ckmd5 ~/Desktop/Inbox/GoogleChrome.dmg 520e8730b8d1551db45eb56649473267 ** MD5 matches **This allows you to create other commands that might automate grabbing files and comparing the checksums. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|