vote up 1 vote down star

I've recently installed Linux, and I know that you can use "md5sum filename" in terminal, but on Windows there is an AMAZING software called HashTab that incorporates it into the shell.

Its awesome, you just right click a file, it gives you the md5, crc32, and sha-1, and it provides a box where you can copy the actual md5 and it compares it for you. I think this program is ingenious, and I hope there is an alternative for linux. Does anyone know of one?

flag

Which desktop environment (or really, which file manager) are you using? – David Nov 14 at 8:36
Gnome and nautilus – GiH Nov 14 at 17:27

2 Answers

vote up 3 vote down check

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.

link|flag
Oh, I guess you also wanted it to compare stuff. Shouldn't be too hard to extend the script, but I'll have to do that later. – supercheetah Nov 15 at 14:21
I just realized that I think I could combine the two into one script. I'll do that in a bit. – supercheetah Nov 16 at 2:45
You're awesome! My only complaint is the interface is very primitive, but you made it work :-) – GiH Nov 16 at 19:35
It would probably look better with zenity, but that's not always installed, and I know that gdialog is available anywhere gnome is installed. – supercheetah Nov 17 at 2:28
vote up 1 vote down

I've always liked the handy, script-able md5sum command.
However, there appears to be a Java version called JSummer at Sourceforge.
Maybe, it will work for you.

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.