See the Security and Bug Fixes Section - Grub EFI Install Updates Fix Sticky


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A simple way to check MD5sum
#15
Here it is:
[Image: eXjC9Qh.png]

Name: Checksum
Description: Calculates  checksum.
Command: /usr/scripts/checksum %f
Pattern: *
Appearance: Check all the boxes except Directories

save the script as checksum
make executable
copy the file to /usr/scripts

Code:
#!/bin/bash
# Misko_2083

file="$@"

MD5=(`echo "" | awk '{print "TRUE","MD5", $0}'`)
SHA1=(`echo "" | awk '{print "FALSE","SHA-1", $0}'`)
SHA224=(`echo "" | awk '{print "FALSE","SHA-224", $0}'`)
SHA256=(`echo "" | awk '{print "FALSE","SHA-256", $0}'`)
SHA384=(`echo "" | awk '{print "FALSE","SHA-384", $0}'`)
SHA512=(`echo "" | awk '{print "FALSE","SHA-512", $0}'`)

selection=$(zenity --list --radiolist --height=300 --title="Checksum" --text="File:  <b>${file##*/}</b>\nPick the hash algorithm." --column="Pick" --column="Hash" "${MD5[@]}" "${SHA1[@]}" "${SHA224[@]}" "${SHA256[@]}" "${SHA384[@]}" "${SHA512[@]}")

# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
    exit 0
fi

echo $selection | grep "MD5" > /dev/null
if [ $? = 0 ];then
    md5sum "$file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="MD5sum" --text="Calculating MD5 for:\n${file##*/}" --pulsate --auto-close

    # If Cancel is clicked then remove temporary file and exit
    if [ "${PIPESTATUS[2]}" -ne "0" ]; then
        rm /tmp/sum
        exit 0
    fi

    sum=`cat /tmp/sum`
    zenity --info --title="MD5sum" --text="MD5sum : $sum\nFile :          ${file##*/}"
    rm /tmp/sum
    exit 0
fi

echo $selection | grep "SHA-1" > /dev/null
if [ $? = 0 ];then
    sha1sum "$file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="SHA-1" --text="Calculating SHA-1 for:\n${file##*/}" --pulsate --auto-close

    # If Cancel is clicked then remove temporary file and exit
    if [ "${PIPESTATUS[2]}" -ne "0" ]; then
        rm /tmp/sum
        exit 0
    fi

    sum=`cat /tmp/sum`
    zenity --info --title="SHA-1" --text="SHA-1: $sum\nFile :    ${file##*/}"
    rm /tmp/sum
    exit 0
fi

echo $selection | grep "SHA-224" > /dev/null
if [ $? = 0 ];then
    sha224sum "$file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="SHA-224" --text="Calculating SHA-224 for:\n${file##*/}" --pulsate --auto-close

    # If Cancel is clicked then remove temporary file and exit
    if [ "${PIPESTATUS[2]}" -ne "0" ]; then
        rm /tmp/sum
        exit 0
    fi

    sum=`cat /tmp/sum`
    zenity --info --title="SHA-224" --text="SHA-224 : $sum\nFile :         ${file##*/}"
    rm /tmp/sum
    exit 0
fi

echo $selection | grep "SHA-256" > /dev/null
if [ $? = 0 ];then
    sha256sum "$file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="SHA-256" --text="Calculating SHA-256 for:\n${file##*/}" --pulsate --auto-close

    # If Cancel is clicked then remove temporary file and exit
    if [ "${PIPESTATUS[2]}" -ne "0" ]; then
        rm /tmp/sum
        exit 0
    fi

    sum=`cat /tmp/sum`
    zenity --info --title="SHA-256" --text="SHA-256 : $sum\nFile :         ${file##*/}"
    rm /tmp/sum
    exit 0
fi

echo $selection | grep "SHA-384" > /dev/null
if [ $? = 0 ];then
    sha384sum "$file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="SHA-384" --text="Calculating SHA-384 for:\n${file##*/}" --pulsate --auto-close

    # If Cancel is clicked then remove temporary file and exit
    if [ "${PIPESTATUS[2]}" -ne "0" ]; then
        rm /tmp/sum
        exit 0
    fi

    sum=`cat /tmp/sum`
    zenity --info --title="SHA-384" --text="SHA-384 : $sum\nFile :         ${file##*/}"
    rm /tmp/sum
    exit 0
fi

echo $selection | grep "SHA-512" > /dev/null
if [ $? = 0 ];then
    sha512sum "$file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="SHA-512" --text="Calculating SHA-512 for:\n${file##*/}" --pulsate --auto-close

    # If Cancel is clicked then remove temporary file and exit
    if [ "${PIPESTATUS[2]}" -ne "0" ]; then
        rm /tmp/sum
        exit 0
    fi

    sum=`cat /tmp/sum`
    zenity --info --title="SHA-512" --text="SHA-512 : $sum\nFile :         ${file##*/}"
    rm /tmp/sum
    exit 0
fi
Reply


Messages In This Thread
A simple way to check MD5sum - by misko_2083 - 08-20-2014, 12:59 AM
Re: A simple way to check MD5sum - by Valtam - 08-20-2014, 01:07 AM
Re: A simple way to check MD5sum - by rokytnji - 08-20-2014, 02:30 AM
Re: A simple way to check MD5sum - by misko_2083 - 08-20-2014, 09:11 AM
Re: A simple way to check MD5sum - by misko_2083 - 10-10-2014, 01:42 PM
Re: A simple way to check MD5sum - by rokytnji - 10-10-2014, 02:54 PM
Re: A simple way to check MD5sum - by misko_2083 - 10-10-2014, 03:36 PM
Re: A simple way to check MD5sum - by rokytnji - 10-10-2014, 05:00 PM
Re: A simple way to check MD5sum - by misko_2083 - 10-11-2014, 05:19 PM
Re: A simple way to check MD5sum - by rokytnji - 10-11-2014, 05:39 PM
Re: A simple way to check MD5sum - by mlsmith - 12-06-2014, 03:25 AM
Re: A simple way to check MD5sum - by misko_2083 - 12-06-2014, 06:25 AM
Re: A simple way to check MD5sum - by mlsmith - 12-06-2014, 03:38 PM
Re: A simple way to check MD5sum - by misko_2083 - 12-07-2014, 02:13 AM
Re: A simple way to check MD5sum - by misko_2083 - 12-07-2014, 09:33 AM
Re: A simple way to check MD5sum - by mlsmith - 12-07-2014, 01:17 PM
Re: A simple way to check MD5sum - by misko_2083 - 12-07-2014, 02:07 PM
Re: A simple way to check MD5sum - by gold_finger - 12-07-2014, 05:04 PM
Re: A simple way to check MD5sum - by mlsmith - 12-07-2014, 09:14 PM
Re: A simple way to check MD5sum - by misko_2083 - 12-09-2014, 03:02 AM
Re: A simple way to check MD5sum - by bitsnpcs - 01-14-2017, 05:56 PM
Re: A simple way to check MD5sum - by firenice03 - 01-14-2017, 07:27 PM
Re: A simple way to check MD5sum - by bitsnpcs - 01-14-2017, 11:51 PM
Re: A simple way to check MD5sum - by ralphy - 04-03-2017, 02:49 PM
Re: A simple way to check MD5sum - by Vera - 05-31-2017, 11:26 AM
Re: A simple way to check MD5sum - by ralphy - 05-31-2017, 01:53 PM
Re: A simple way to check MD5sum - by tuto - 09-06-2018, 12:40 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)