Another way to pipe the string to openssl without a trailing NL is
openssl
printf "password" | openssl dgst -sha512