从Linux命令行生成SHA-256哈希

我知道字符串“foobar”使用
http://hash.online-convert.com/sha256-generator

但是命令行shell:

[email protected]~$echo foobar | sha256sum
AEC070645FE53EE3B37630593766134F058CC337247C978ADD178B6CCDFB0019F-

生成不同的哈希。我错过了什么

echo通常会输出一个换行符,该换行符被-n抑制。试试这个:

echo-n foobar | sha256sum

发表评论