为什么 Perl 和/bin/sha1 给出不同的结果? [英] Why does Perl and /bin/sha1 give different results?
本文介绍了为什么 Perl 和/bin/sha1 给出不同的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很困惑为什么以下返回单独的 sHA1
I'm confused as to why the following return separate sHA1s
$ perl -MDigest::SHA1 -E'say Digest::SHA1::sha1_hex("http://i.aultec.com/v/8066/Originals/1FTVX12585NA9832010.jpg");'
e1133fa3b7ea0bfb8ffa4d877932ed6c6fa10cef
$ echo "http://i.aultec.com/v/8066/Originals/1FTVX12585NA9832010.jpg" | sha1sum
5c3731e83ae0184ed93b595b9f5604863dd331e6 -
哪个是对的?/我/做错了吗?
Which one is right? Am /I/ doing it wrong?
$ perl -MDigest::SHA -E'say Digest::SHA::sha1_hex("http://i.aultec.com/v/8066/Originals/1FTVX12585NA9832010.jpg");'
e1133fa3b7ea0bfb8ffa4d877932ed6c6fa10cef
您可以在后继 (Digest::SHA
) 中看到摘要是正确的
You can see the digest is right in the successor (Digest::SHA
)
推荐答案
两者都对.您的 echo 命令在末尾包含一个换行符.(并且 perl 字符串没有)尝试使用 echo -n ...
Both are right. Your echo command includes a newline at the end. (and the perl string doesn't) Try with echo -n ...
这篇关于为什么 Perl 和/bin/sha1 给出不同的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文