Improvements to the checksum tool to add 2 new features: Actually try to verify the file integrity by searching for stored checksum files and also display a progress dialog (throbber) while the checksum is being verified so you know something is happening
Copy the following code as root/sudo into a script file, say checkhash.sh, into /usr/bin after making it executable.
Code:
#! /bin/sh
toolname=`echo $1 | sed "s/\(.*\)/\L\1sum/"`
filepath=`echo $2 | sed "s/\(.*\/\).*/\1/"`
hashfile=`echo $1 | sed "s/\(.*\)/\U\1SUMS/"`
dialogtitle=`echo $1 | sed "s/\(.*\)/\U\1/"`
dcopRef=`kdialog --progressbar "Checking $dialogtitle hash, please wait..." 0 --title "Check $dialogtitle Hash"`
result=`$toolname $2`
filename=`echo $result | sed "s/^\([0-9a-z]*\) .*\/\(.*\)/\2/g"`
checksum=`echo $result | sed "s/^\([0-9a-z]*\) .*\/\(.*\)/\1/g"`
lookup=`grep ${filename} ${filepath}*${hashfile}* 2>/dev/null | grep ${checksum} 2>/dev/null`
findhash=`grep ${checksum} ${filepath}*${hashfile}* 2>/dev/null`
findfile=`grep ${filename} ${filepath}*${hashfile}* 2>/dev/null`
integrity=`if [ "${findfile}file" = "file" ]; then echo unknown; else if [ "${lookup}sum" = "sum" ]; then echo bad; else echo good; fi; fi;`
qdbus $dcopRef org.kde.kdialog.ProgressDialog.close
kdialog --title "Check $dialogtitle Hash" --msgbox "Filename: ${filename}\nChecksum: ${checksum}\nIntegrity: ${integrity}"
Change the checksum.desktop file mentioned in earlier post to have the following code instead:
Code:
[Desktop Entry]
Type=Service
Icon=security-high
Actions=CheckMD5Hash;CheckSHA1Hash;CheckSHA256Hash
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/allfiles
[Desktop Action CheckMD5Hash]
Exec=checkhash.sh md5 %U
Icon=security-high
Name=Check MD5 Hash
[Desktop Action CheckSHA1Hash]
Exec=checkhash.sh sha1 %U
Icon=security-high
Name=Check SHA1 Hash
[Desktop Action CheckSHA256Hash]
Exec=checkhash.sh sha256 %U
Icon=security-high
Name=Check SHA256 Hash
This is to showcase my lame shell scripting skillz, I'm sure this can be cleaned up some more and bugs found and fixed.
Right now, based on convention, it will try to generate the checksum and compare it with any checksums stored in files with SHA256SUMS or MD5SUMS etc in the name. Usually when you download an ISO or something the same web location has the SHA1SUMS file which you normally download to the same local folder.
Works well for me after some quick testing, hope it works for you...