How do I find the sha256 hash of text on a Mac?
You can echo the text and pipe it to shasum
. You'll want to use the -a 256
option to calculate sha256:
Thanks to JMY1000 in the comments: Since echo
adds a newline by default, -n
should probably be added in order to get the proper shasum of the text without this newline.
echo -n "simple text" | shasum -a 256
If you want to get the hash value for a text which is already open in an editor, copy it to the clipboard and run
pbpaste | shasum -a 256