OpenSSL从Shell Stdin创建SHA哈希 [英] OpenSSL create SHA hash from shell stdin
本文介绍了OpenSSL从Shell Stdin创建SHA哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不使用文件的情况下从命令行使用OpenSSL生成SHA-512哈希?
How to generate the SHA-512 hash with OpenSSL from command line without using a file?
我已经尝试过了
echo "password" | openssl dgst -sha512
,但哈希看起来不正确(与 http://hash.online-convert.com/sha512-generator相比) a>).
but the hash looks wrong (compared with http://hash.online-convert.com/sha512-generator).
推荐答案
尝试echo -n "password"
.
发生了什么事,echo
添加到字符串末尾的新行字符被散列了. -n
到echo
抑制了此行为.
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.
这篇关于OpenSSL从Shell Stdin创建SHA哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文