# sha1sum on darwin?



## Sunnz (Aug 15, 2006)

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?


----------



## Sunnz (Jan 29, 2008)

Just incase someone searched for this and want to know how to do it, this is the command:

openssl sha1 <path/filename.ext>


----------



## michaelsanford (Jan 29, 2008)

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

```
#!/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.


----------



## Sunnz (Jan 29, 2008)

With a bash like shell you can place the following in ~/.profile:

```
alias sha1="/usr/bin/openssl sha1"
```
Which really creates a shortcut, that's what 'alias' is for!!


----------



## michaelsanford (Jan 29, 2008)

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).


----------



## Sunnz (Jan 30, 2008)

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.


----------

