For the avalaible downloads here like Sfott, I now make an MD5 checksum.
But I find it really boring to do it once or two or… and then have to select then copy the resulting checksum.
Creating the result is not really hard at all
openssl md5 ./somefile.txt
openssl md5 /a_path_to/somefile.txt
or
md5 ./somefile.txt
md5 /a_path_to/somefile.txt
and you’re good to go and have a checksum like so
MD5 (./somefile.txt) = 9626c9c0885003fa7a87b9f8043c16bc
Great. but now what ?
What if I’d like to create a checksum for a file and have it copied to my clipboard
( to save me the hassle of selecting the result after the = sign with the mouse
and then hit command-C or right-clic copy ?? or go to menu / Edit / Copy ??? )
So I then just have to paste it else where. Time saving.
or even better What if I’d like to compare a given checksum for a given file I’ve downloaded for example ?
do the same as above for the downloaded file then compare both the result and what is given ? Come on.
I don’t mind to go to the Terminal, I actually go way more than I thought I would, but I’m lazy.
If I have to do something more than once I’ll do all I can to automate it – I like to say.
Maybe there is a built-in command to compare md5, I didn’t really searched for that, and it was a good way to practice coding again.
So here it is some utilities to either compare a file and a checksum or simply create a Checkum.
What you’ll find :
CreateMD5 :
- A small App to only create a checksum and have it copied to the clipboard
How it works
Simply drag a file on it.
CompareMD5 ( it comes with 3 elements ) :
-
A small App to compare the file Checksum with a given Cheksum OR only create a checksum.
-
A Service to put in /Library/Services or ~/Library/Services
-
A Shell script to put where you want it to be.
How it works
For the App and the Service :
-
Simply drag a file on it (or ctrl-clic / right-clic on a file for the service)
-
You’ll then be prompted to enter the checksum of the file if you have it, it is optional and not mandatory.
-
If you have entered a Checksum it will compare what you entered and the file cheskum and give you the result
either the Checksums match or they don’t. -
If you did not entered a Chesksum then it will only create the Checksum for the file, show it to you and save it in your clipboard.
- Drag and drop File and No checksum entered, will create a checksum and copy it to clipboard
- Checksum created and copied to clipboard
- Drag and drop file and (correct) Checksum entered
- Checksums match
- Drag and drop file and (wrong) Checksum entered
- Checksum Do not match
For the script
I put it in /usr/local/oemden/ and simply create an aias in my bash profile
#cccmd5 alias
alias cccmd5='/usr/local/oemden/cccmd5'
If like me you have an alias then call it as you named it (I use cccmd5 – create compare checksum md5 )
- You must at least append one argument for the file to checksum
-
Optionnaly you can add a checksum to compare as a second argument.
-
If you have entered a Checksum it will compare what you entered and the file cheskum and give you the result. Either the Checksums match or they don’t.
-
If you did not entered a Chesksum then it will only create the Checksum for the file, show it to you and save it in your clipboard.
- script with no args will give an error
- error if no args
- script called with no checksum. Will create a checksum
- Checksum created and copied to clipboard
- script invoqued with a file and a checksum to compare
- compare is OK checksums match
- script invoqued with a file and a (wrong) checksum.
- Compare is WRONG checksum do not match
It now will be much faster to create MD5 checksum and eventually compare them :)
Get the files
You can grab the files from the downloads page :
EDIT : the Apps don’t work on 10.6, but Services and script do. I’ll create a 10.6 App. (This is an automator backward compatibility issue, and I’ll see if I can get rid of this if not I’ll make a specific 10.6 release)
ToDo :
Add the possibility to have a txt file input as the second argument.
Easy for the Terminal a bit less easy for Automator Applescript…
Note : This is for OsX but the script itself should work on UNIX/LINUX as there is no special Mac commands here.
[…] I’ve since made a small utility (two actually) to create MD5 Checksums quickly and get copied … […]