This is the next best thing, I think. Put the following code into $HOME/.gnome2/nautilus-scripts
:
#!/bin/sh
# Released into the public domain.
#
for arg
do
md5=$(md5sum "$arg" | awk '{print $1}')
sha1=$(sha1sum "$arg" | awk '{print $1}')
crc32=$(crc32 "$arg")
gdialog --title "Hashes" --msgbox "File $arg\nmd5 $md5\nsha1 $sha1\ncrc32 $crc32" 800 1100
done
I called the file hashes
, but you can call it whatever you want. Make sure to set the execute permission (e.g. chmod +x hashes
).
Here's the second part I promised:
#!/bin/sh
# Released into the public domain.
#
for arg
do
md5=$(md5sum "$arg" | awk '{print $1}')
md5compare=$(gdialog --title "MD5 comparison" --inputbox "MD5 hash to compare:" 200 3>&1 1>&2 2>&3)
if [ "$md5compare" = "$md5" ]; then
gdialog --title "Match" --msgbox "Match confirmed" 200 200
else
gdialog --title "No match" --msgbox "No match" 200 200
fi
done
This second script I called compare hashes
.
EDIT: This is the final version. This one does both the hashes, and comparison with a while
loop so that more than one comparison can be done.
#!/bin/sh
# Released into the public domain.
#
for arg
do
md5=$(md5sum "$arg" | awk '{print $1}')
sha1=$(sha1sum "$arg" | awk '{print $1}')
crc32=$(crc32 "$arg")
compare_msg="MD5 hash to compare:"
md5compare=$(gdialog --title "Hashes and MD5 comparison" --inputbox "File $arg\nmd5\t\t$md5\nsha1\t\t$sha1\ncrc32\t$crc32\n\n$compare_msg" 1100 3>&1 1>&2 2>&3 )
while [ $? -eq 0 ]
do
if [ "$md5compare" = "$md5" ]; then
compare_msg="Match confirmed"
else
compare_msg="No match\n\t\t$md5compare"
fi
md5compare=$(gdialog --title "Hashes and MD5 comparison" --inputbox "File $arg\nmd5\t\t$md5\nsha1\t\t$sha1\ncrc32\t$crc32\n\n$compare_msg" 1100 3>&1 1>&2 2>&3 )
done
done
This final version I called hash and compare
.
EDIT: I just added some formatting niceties.
EDIT: I figured out how to avoid using a temporary file.
+1 for explaining what it does, and not assuming everybody will know it. – user unknown – 2011-06-21T22:44:52.023
Which desktop environment (or really, which file manager) are you using? – David Z – 2009-11-14T08:36:34.020
Gnome and nautilus – GiH – 2009-11-14T17:27:51.793