Digest::SHA 相对于 Digest::SHA1 有哪些优点?

发布于 2024-09-12 23:28:27 字数 287 浏览 9 评论 0原文

使用 Digest::SHA 有什么优势超过 Digest::SHA1 或反之亦然?两者似乎都得到了维护,但我不认为 Digest::SHA1 与 Digest::SHA1 一起存在的原因。

Are there any advantages in using Digest::SHA over Digest::SHA1 or vice versa? both seem to be maintained but I don't see a reason for Digest::SHA1 to even exist with the existence of Digest::SHA.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笔芯 2024-09-19 23:28:27

没有,Digest::SHA1 是遗留的,SHA1 也是如此。根据 Digest::SHA1 的文档:

2005 年,SHA-1 中发现了安全缺陷,即可能存在数学缺陷,这表明需要更强的哈希函数。 Digest::SHA 模块实现了 SHA 系列中更强大的算法。

它清楚地引用了Digest::SHADigest::SHA 中的实现比 Digest::SHA1 快一点(根据 Digest.pm 的文档 - 你应该做什么无论如何可能正在使用)。

Algorithm      Size    Implementation                  MB/s
SHA-1          160     Digest::SHA v4.3.1              58.9
SHA-1          160     Digest::SHA1 v2.10              48.8

DigestDigest 命名空间中所有模块的工厂,它优先考虑 Digest::SHA 而不是 Digest::SHA1。您甚至可以认为 Digest::SHA1 已被弃用了两倍,因为它已被 Digest::SHA2 取代。

我相信在这里证实“已弃用”一词可能有用。我的意思只是说 Digest::SHA1 对于 SHA 系列中的非 SHA1 哈希值没有用处——其他发行版可以处理更多.. Digest::SHA1 也更慢..据我所知,它仍然受到支持,并且不久前就有了稳定版本:Digest-SHA1-2.13 - 03 Jul 2010 - Gisle Aas

There is none, Digest::SHA1 is legacy, as is SHA1. Per the docs of Digest::SHA1:

In 2005, security flaws were identified in SHA-1, namely that a possible mathematical weakness might exist, indicating that a stronger hash function would be desirable. The Digest::SHA module implements the stronger algorithms in the SHA family.

It clearly references Digest::SHA. The implementation in Digest::SHA is a bit faster than Digest::SHA1 (per the docs of Digest.pm -- what you should probably be using anyway).

Algorithm      Size    Implementation                  MB/s
SHA-1          160     Digest::SHA v4.3.1              58.9
SHA-1          160     Digest::SHA1 v2.10              48.8

Digest is a factory for all modules in the Digest namespace, it prioritizes Digest::SHA over Digest::SHA1. You could even argue Digest::SHA1 is twice over deprecated, as it was replaced by Digest::SHA2.

I believe it probably useful to substantiate the term "deprecated" here. I simply mean that Digest::SHA1 isn't useful for non-SHA1 hashes that are still in the SHA family -- other distros can handle more.. Digest::SHA1 is also slower.. To the best of my knowledge it is still supported and has a stable release not all that long ago: Digest-SHA1-2.13 - 03 Jul 2010 - Gisle Aas

美人迟暮 2024-09-19 23:28:27

编写为使用 Digest::SHA1::sha1 的内容,或者(愚蠢地)使用 "Digest::$type"->new 代替的内容Digest->new($type) 可能需要 Digest::SHA1。除此之外,首选 Digest::SHA,并且默认情况下将其用于 Digest->new("SHA-1")

Stuff that was written to use Digest::SHA1::sha1, or which (in a fit of silliness) does "Digest::$type"->new instead of Digest->new($type) might need Digest::SHA1. Other than that, Digest::SHA is preferred, and it will be used by default for Digest->new("SHA-1").

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文