Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Applescript droplet to get the SHA1 checksum' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Applescript droplet to get the SHA1 checksum
Authored by: djdawson on Jun 11, '10 10:19:59AM
I created a similar script some time ago that handles multiple files and computes the MD5, SHA, and SHA1 checksums of all the files dragged onto it. It also reformats the output so the checksums appear at the beginning of each line, since that makes it easier to compare a list of checksums, and it puts the output in a new TextEdit document so it can be easily saved, copied, etc. I've pasted the script below, but I don't know how well the various quotes, etc. will be handled:


on open TheseItems
	set FILE_LIST to ""
	repeat with N from 1 to the count of TheseItems
		set ThisItem to item N of TheseItems as text
		set PNAME to POSIX path of ThisItem
		set FILE_LIST to FILE_LIST & " " & quoted form of PNAME
	end repeat
	set CHKSUM_MD5 to do shell script "/usr/bin/openssl dgst -md5 " & FILE_LIST & " | awk -F '= ' '{print $2, \"=\", $1};'"
	set CHKSUM_SHA to do shell script "/usr/bin/openssl dgst -sha " & FILE_LIST & " | awk -F '= ' '{print $2, \"=\", $1};'"
	set CHKSUM_SHA1 to do shell script "/usr/bin/openssl dgst -sha1 " & FILE_LIST & " | awk -F '= ' '{print $2, \"=\", $1};'"
	tell application "TextEdit"
		launch
		make new document
		set text of front document to CHKSUM_MD5 & return & return & CHKSUM_SHA & return & return & CHKSUM_SHA1
		tell the text of the front document
			set the font to "Courier"
			set the size to 12
		end tell
	end tell
	tell application "TextEdit" to activate
end open


[ Reply to This | # ]
Applescript droplet to get the SHA1 checksum
Authored by: jnsimonhints on Jun 11, '10 01:11:12PM

I have a command "shasum" that seems to be part of perl that does SHA1 checksums and seems to be a lot faster that using openSSL to do it.



[ Reply to This | # ]