sha1sum on darwin?

Sunnz

Who wants a stylus?
I tried enter the command, but it is not there... so it doesn't come with darwin? Do I need to get it from somewhere?
 
Just incase someone searched for this and want to know how to do it, this is the command:

openssl sha1 <path/filename.ext>
 
Very good of you to post the answer!

Incidentally, most of those shortcut commands for openssl can be re-created by either making a one-liner shell script, or through Fink (I'm pretty sure Fink includes a few shortcuts like md5sum).

For a one-liner shortcut, you could create a script called sha1sum with
Code:
#!/bin/bash
/usr/bin/openssl sha1 $1
You can replace "sha1" with any of the digests openssl supports.

Though, IMHO, this type of shortcut is really not that useful.
 
With a bash like shell you can place the following in ~/.profile:
Code:
alias sha1="/usr/bin/openssl sha1"
Which really creates a shortcut, that's what 'alias' is for!!
 
Quite right!

I don't use the alias directive enough to have made a correct suggestion on it. For example, I wasn't sure if you had to include a parameter variable in the alias directive like you do in a shell script (obviously not, from your example).
 
Aha, with alias, it is like a simple replacement macro in C, the bash interpreter search for sha1, replaces it with whatever in the quote ("/usr/bin/openssl sha1") THEN it is executed.
 
Back
Top