skip to content
Alvin Lucillo

Get SHA256 hash value

/ 1 min read

💻 Tech

To quickly get the SHA256 hash from the terminal:

echo -n "123" | sha256sum | cut -d ' ' -f1
a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3

Without cut, you will get:

echo -n "123" | sha256sum
a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3  -

What cut does is set a delimiter, which is a space in our example. It will return 3 values, and we’re only interested in the hash, so we pass -f1 to get the first field.