从Linux命令行生成sha256 [英] Generating a sha256 from the Linux command line
本文介绍了从Linux命令行生成sha256的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道字符串"foobar"使用以下命令生成SHA 256哈希c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
http://hash.online-convert.com/sha256-generator
I know the string "foobar" generates the SHA 256 hash c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
using
http://hash.online-convert.com/sha256-generator
但是命令行外壳:
hendry@x201 ~$ echo foobar | sha256sum
aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f -
生成另一个哈希.我想念什么?
Generates a different hash. What am I missing?
推荐答案
echo
通常将输出换行符,并用-n
禁止换行.试试这个:
echo
will normally output a newline, which is suppressed with -n
. Try this:
echo -n foobar | sha256sum
这篇关于从Linux命令行生成sha256的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文