01-14-2017, 05:56 PM
01-14-2017, 07:27 PM
If Vista and newer - Powershell should be installed by default, you can run the below command to check the MD5 checksum.. May alleviate the need to download a tool so you can dive right into a LL install 8) LOL
Its in tutorials as well: https://www.linuxliteos.com/forums/tutor.../#msg22470
Command to paste into Powershell:
C
ATH_to_FILE\File_name.iso -- The full path and the .iso file
"PASTE_HASH_between_quotes" -- Paste the supplied hash
If the hash checks out it returns an ok.. If not it will be blank...
Its in tutorials as well: https://www.linuxliteos.com/forums/tutor.../#msg22470
Command to paste into Powershell:
Code:
if ( $($(CertUtil -hashfile C:PATH_to_FILE\File_name.iso MD5)[1] -replace " ","") -eq "PASTE_HASH_between_quotes" ) { echo "ok" }
C

"PASTE_HASH_between_quotes" -- Paste the supplied hash
If the hash checks out it returns an ok.. If not it will be blank...
01-14-2017, 11:51 PM
Appreciate the help. Unsure why is not default on Windows 10 for me. So I had used the tool.
04-03-2017, 02:49 PM
(12-07-2014, 09:33 AM)misko_2083 link Wrote: [ -> ]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
I find the script rather useful. I've modified it to allow users to select a file just by launching the script. If the custom action in Thunar is configured, it will allow users to right-click and select files without prompting to browse for the file.
Extract and move the extracted files to their respective locations.
/usr/scripts/checksum
/usr/share/applications/checksum.desktop
Here is what it looks like:
![[Image: mVZxS0C.png]](http://i.imgur.com/mVZxS0C.png)
![[Image: I1HNS17.png]](http://i.imgur.com/I1HNS17.png)
![[Image: bjIYcAt.png]](http://i.imgur.com/bjIYcAt.png)
![[Image: 1JTLorM.png]](http://i.imgur.com/1JTLorM.png)
![[Image: 7sKrZU4.png]](http://i.imgur.com/7sKrZU4.png)
Cheers!
Code:
#!/bin/bash
# Misko_2083, Ralphy
ic="/usr/share/icons/Faenza/actions/32/system-run.png"
# user selected file
file="$@"
if [ -z "$@" ]; then szPath=$(zenity --file-selection --title="Checksum - Select file..." --file-filter='Image files (ISO,IMG) | *.iso *.ISO *.img *.IMG' --file-filter='All files | *');
if [ "$?" -eq "1" ]; then exit 0; else file="$szPath"; fi; fi
while (true); do
MD5=(`echo "" | awk '{print "md5sum","✍","MD5", $0}'`); SHA1=(`echo "" | awk '{print "sha1sum","✍","SHA-1", $0}'`)
SHA224=(`echo "" | awk '{print "sha224sum","✍","SHA-224", $0}'`); SHA256=(`echo "" | awk '{print "sha256sum","✍","SHA-256", $0}'`)
SHA384=(`echo "" | awk '{print "sha384sum","✍","SHA-384", $0}'`); SHA512=(`echo "" | awk '{print "sha512sum","✍","SHA-512", $0}'`)
# main dialog
selected=$(zenity --list --width=180 --height=248 --window-icon="$ic" --hide-header --title=" Checksum" --text="File: <b>${file##*/}</b>\n\nSelect the Hash algorithm\n" \
--hide-column="1" --separator="," --print-column="1,3" --column="Checksum" --column="" --column="Hash" "${MD5[@]}" "${SHA1[@]}" "${SHA224[@]}" "${SHA256[@]}" "${SHA384[@]}" "${SHA512[@]}")
# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then exit 0; fi
# read selection and split it
checksum=$(awk -F, '{print $1}' <<<$selected)
dialog=$(awk -F, '{print $2}' <<<$selected)
if [ "$checksum" == "" ]; then zenity --warning --window-icon="warning" --text="\nNo Hash algorithm was selected. Please try again. " --timeout="3"; continue; else :; fi
# temp sum file
TMPF="/tmp/sum"
# common function - if cancel then remove $TMPF and exit
action_cancel() { if [ "${PIPESTATUS[2]}" -ne "0" ]; then rm $TMPF; exit 0; fi }
action_sum() { sum=`cat $TMPF`; zenity --info --title="$dialog" --text="\nFile:<b> ${file##*/} </b>\n\n$dialog: $sum"; rm -f $TMPF & exit 0; }
"$checksum" "$file" | tee >(cut -d ' ' -f1 > $TMPF) |zenity --window-icon="info" --width=240 --progress --title="$dialog" --text="File:<b> ${file##*/} </b>\n\n- Calculating $dialog. Please wait..." --pulsate --auto-close
action_cancel
action_sum
done
exit
05-31-2017, 11:26 AM
That's an exciting way of adding it to a GUI through Thunar.
On LinuxLite, when I've needed to check MD5 (or other hash sums) I've just gone for a simple approach and used the command line with the built-in md5sum function (or sha1sum or sha256sum depending what function I want to use). It has worked well for me when checking copied or downloaded ISO's against original. I haven't used it for anything more advanced than that though.
I do like the addition to Thunar that you mentioned since it would allow the function to always just "be there" as an option for doing checksum of any file via GUI, which definitely is helpful. Thanks for the tutorial.
On LinuxLite, when I've needed to check MD5 (or other hash sums) I've just gone for a simple approach and used the command line with the built-in md5sum function (or sha1sum or sha256sum depending what function I want to use). It has worked well for me when checking copied or downloaded ISO's against original. I haven't used it for anything more advanced than that though.
I do like the addition to Thunar that you mentioned since it would allow the function to always just "be there" as an option for doing checksum of any file via GUI, which definitely is helpful. Thanks for the tutorial.
05-31-2017, 01:53 PM
[member=6960]Vera[/member]
A month ago I switched the script to yad. I will add it to my repo so it can be easily installed. It creates the Thunar contextual menu option on install too and adds an option to copy the final sum to clipboard.
![[Image: 3bC9YeY.png]](http://i.imgur.com/3bC9YeY.png)
A month ago I switched the script to yad. I will add it to my repo so it can be easily installed. It creates the Thunar contextual menu option on install too and adds an option to copy the final sum to clipboard.
![[Image: 3bC9YeY.png]](http://i.imgur.com/3bC9YeY.png)
09-06-2018, 12:40 AM
Hi, community.
[member=378]misko_2083[/member] and [member=6629]ralphy[/member], this is great script. Thank you.
I do known not much about shell scripting, but I modify this checksum script for hash check, such as in gtkhash application.
Any improvement is welcome.
I am sorry by bad English language use; I am learning, yet..
[member=378]misko_2083[/member] and [member=6629]ralphy[/member], this is great script. Thank you.
I do known not much about shell scripting, but I modify this checksum script for hash check, such as in gtkhash application.
Any improvement is welcome.
I am sorry by bad English language use; I am learning, yet..
Code:
#!/bin/bash
# Autors: Misko_2083, Ralphy
# Tomado desde: https://www.linuxliteos.com/forums/tutorials/a-simple-way-to-check-md5sum/15/
# Adapted by : tuto
#
# #####################################################################
# Images
ic="/usr/share/icons/Faenza/actions/32/system-run.png"
# ### User selected file.
file="$@"
if [ -z "$@" ]; then
szPath=$(zenity --file-selection --title="Checksum - Select file..." --file-filter='Image files (ISO,IMG) | *.iso *.ISO *.img *.IMG' --file-filter='All files | *')
if [ "$?" -eq "1" ]; then
exit 0
else
file="$szPath"
fi
fi
while (true); do
MD5=(`echo "" | awk '{print "md5sum","✍","MD5", $0}'`)
SHA1=(`echo "" | awk '{print "sha1sum","✍","SHA-1", $0}'`)
SHA224=(`echo "" | awk '{print "sha224sum","✍","SHA-224", $0}'`)
SHA256=(`echo "" | awk '{print "sha256sum","✍","SHA-256", $0}'`)
SHA384=(`echo "" | awk '{print "sha384sum","✍","SHA-384", $0}'`)
SHA512=(`echo "" | awk '{print "sha512sum","✍","SHA-512", $0}'`)
# ### Main dialog.
selected=$(zenity --list --width=180 --height="248" --window-icon="$ic" --hide-header --title=" Checksum" \
--text="File: <b>${file##*/}</b>\n\nSelect the Hash algorithm\n" --hide-column="1" --separator="," \
--print-column="1,3" \
--column="Checksum" \
--column="" \
--column="Hash" "${MD5[@]}" "${SHA1[@]}" "${SHA224[@]}" "${SHA256[@]}" "${SHA384[@]}" "${SHA512[@]}")
# ### If quit is clicked then exit.
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
exit 0
fi
# ### Read selection and split it.
checksum=$(awk -F, '{print $1}' <<<$selected)
dialog=$(awk -F, '{print $2}' <<<$selected)
if [ "$checksum" == "" ]; then
zenity --warning --window-icon="warning" --text="\nNo Hash algorithm was selected. Please, try again. " --timeout="3"; continue
else
:
fi
# ### Temp sum file.
TMPF="/tmp/sum"
# ### Common function - If cancel then remove $TMPF and exit.
action_cancel() { if [ "${PIPESTATUS[2]}" -ne "0" ]; then
rm $TMPF; exit 0
fi
}
action_sum() { sum=`cat $TMPF`; zenity --info --title="$dialog" --text="\nFile:<b> ${file##*/} </b>\n\n$dialog: $sum" --ok-label="Ok"; rm -f $TMPF
}
action_compare() { zenity --question --window-icon="$ic" --title="Hash Check" --text="You want verify the calculated hash?" --cancel-label="No" --ok-label="Yes"
if [ "$?" != "0" ]; then
exit 0
else
ctrlsum=`zenity --entry --window-icon="$ic" --title="Hash Check" --text="Enter a control sum value" --cancel-label="Close" --ok-label="Ok"`;
if [ "$ctrlsum" != "" ] && [ "$ctrlsum" == "$sum" ]; then
zenity --info --window-icon="$ic" --title="Hash Check" --text="<b>Checksum</b> is correct.\nThe file is complete."
elif [ "$ctrlsum" != "" ] && [ "$ctrlsum" != "$sum" ]; then
zenity --error --title="Hash Check" --text="<b>Checksum no match</b>.\nThe file is incomplete or corrupt."; continue
else
exit 0
fi
exit 0
fi
}
"$checksum" "$file" | tee >(cut -d ' ' -f1 > $TMPF) | zenity --window-icon="info" --progress --title="$dialog" --text="File:\n<b> ${file##*/} </b>\n\n- Calculating $dialog. Please, wait..." --pulsate --auto-close
action_cancel
action_sum
action_compare
done
exit