Skip to content

Instantly share code, notes, and snippets.

@oelna
Created November 9, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oelna/00c5ecc2fbf95196fca1f6ea13ef58d9 to your computer and use it in GitHub Desktop.
Save oelna/00c5ecc2fbf95196fca1f6ea13ef58d9 to your computer and use it in GitHub Desktop.
Ways to generate hashes on macOS (BSD)
# shasum
## value of algorithm can be 1, 224, 256, 384, 512
## hash of string
echo -n "foobar" | shasum -a 256
## hash of file content
shasum -a 256 filename.ext
shasum --algorithm 256 /path/filename.ext
# openssl
## value of digest can be -md4, -md5, -ripemd160, -sha, -sha1, -sha224, -sha256, -sha384, -sha512, -whirlpool
## hash of string
echo -n "foobar" | openssl dgst -sha256
## hash of file content
openssl dgst -sha256 /path/filename.ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment