OpenSSL create SHA hash from shell stdin OpenSSL create SHA hash from shell stdin unix unix

OpenSSL create SHA hash from shell stdin


Try echo -n "password".

What's happening is the new line character(s) that echo adds to the end of the string are getting hashed. The -n to echo suppresses this behavior.


If you're using MacOS, you might stumble upon a case where the echo is ignoring the -n argument. To workaround that, call the binary directly:

/bin/echo -n "password" | openssl sha512