Skip to content

Instantly share code, notes, and snippets.

@paulgibbs
Created December 30, 2016 20:25
Show Gist options
  • Save paulgibbs/9e3207fd912f84935d9bc888ae08beaa to your computer and use it in GitHub Desktop.
Save paulgibbs/9e3207fd912f84935d9bc888ae08beaa to your computer and use it in GitHub Desktop.
WHSHASCRIPT="sha1sum" && (type sha1sum >/dev/null 2>&1 || WHSHASCRIPT="shasum")
@henrywright
Copy link

Also I agree my original guess is wrong. I assumed you had sha1sum on your Mac, which of course you don't.

@paulgibbs
Copy link
Author

paulgibbs commented Jan 1, 2017

For the record, I've iterated on this approach; I was using this to find which sha-1 tool exists (mac vs most linux) - and then run it - but i've switched approach to using the openssl program, like this: cat %2$s | openssl dgst -sha1 -binary | xxd -p

@henrywright
Copy link

Only problem I can see with using that program is how can you guarantee the binary is in the user's path?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment