512 位哈希与 4 128 位哈希

发布于 2024-12-04 19:12:42 字数 659 浏览 3 评论 0原文

有趣的是,我还没有找到足够的信息,关于单个 512 位哈希(如 Whirlpool)与 4 128 位哈希(如 md5、sha1 等)串联的碰撞机会的任何测试或实验。4

128 位哈希出现相同的可能性似乎比单个 512 位哈希的可能性更小。执行散列的数据相当小,平均只有 100 个字符。

但这只是一个明显的猜测,没有任何依据,因为我没有进行任何测试。你对此有何看法?

编辑其喜欢 512 位哈希与 128 位哈希。 128位哈希。 128位哈希。 128位哈希(4个128位哈希连接)

Edit2 我想对此使用哈希 考虑 RAM 的 url 索引或哈希 目的是尽量减少冲突的可能性,因为我想将哈希列设置为唯一而不是 url 列。

编辑3 请注意,此问题的目的是找到最小化碰撞可能性的方法。话虽如此,为什么我需要更多地关注尽量减少碰撞的可能性呢?这是我的 Edit2 描述,它导致找到使用更少 RAM 的解决方案。因此,我们的兴趣在于最大限度地减少冲突和降低 RAM 使用量。但这个问题的主要焦点是降低碰撞的可能性。

Interestingly I haven't found enough information regarding any test or experiment of collision chances of single 512bit hash like whirlpool versus concatenation of 4 128bit hashes like md5, sha1 etc.

Possibility of 4 128bit hashes to appear same seems less probable than single 512bit hash when the data on which hashing is performed is considerably of small size merely on average 100 characters.

But its just an apparent guess with no basis because I haven't performed any test. What you think about it?

Edit its like
512bit hash vs 128bit hash . 128bit hash . 128bit hash . 128bit hash (4 128bit hash concatenated)

Edit2
I want to use hash for this index on url or hashing considering RAM
and purpose is to minimize the possibility of collision because I want to set hash column as unique instead of url column.

Edit3
Please note that purpose of this question is to find the way to minimize the possibility of collision. Having said that, Why I need to focus more on minimizing the possibility of collision? Here comes my Edit2 description which leads to finding the solution to use less RAM. So, interests are both in minimizing the collision and lower RAM usage. But prime focus of this question is lowering the possibility of collision.

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

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

发布评论

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

评论(4

你的笑 2024-12-11 19:12:42

听起来您想将以下内容的碰撞行为进行比较:

hash512(x)

与以下内容的碰撞行为:

hash128_a(x) . hash128_b(x) . hash128_c(x) . hash128_d(x)

其中“.”表示串联,hash128_ahash128_b等是四种不同的128位哈希算法。

答案是:这完全取决于所涉及的各个哈希的属性。

例如,考虑 128 位哈希函数可以实现为:

uint128_t hash128_a(T x)   { return hash512(x)[  0:127]; }
uint128_t hash128_b(T x)   { return hash512(x)[128:255]; }
uint128_t hash128_c(T x)   { return hash512(x)[256:383]; }
uint128_t hash128_d(T x)   { return hash512(x)[384:511]; }

在这种情况下,性能将是相同的。

It sounds like you want to compare the collision behaviour of:

hash512(x)

with the collision behaviour of:

hash128_a(x) . hash128_b(x) . hash128_c(x) . hash128_d(x)

where "." denotes concatenation, and hash128_a, hash128_b, etc. are four different 128-bit hash algorithms.

The answer is: it depends entirely on the properties of the individual hashes involved.

Consider, for instance that the 128-bit hash functions could be implemented as:

uint128_t hash128_a(T x)   { return hash512(x)[  0:127]; }
uint128_t hash128_b(T x)   { return hash512(x)[128:255]; }
uint128_t hash128_c(T x)   { return hash512(x)[256:383]; }
uint128_t hash128_d(T x)   { return hash512(x)[384:511]; }

In which case, the performance would be identical.

陪我终i 2024-12-11 19:12:42

关于这个问题的经典文章来自 Hoch 和 Shamir 。它建立在之前的发现之上,尤其是 Joux 的发现。底线如下:如果您采用四个具有 128 位输出的哈希函数,并且这四个哈希函数使用 Merkle-Damgård 构造,那么为整个 512 位输出找到碰撞不再困难而不是寻找哈希函数之一的冲突。 MD5、SHA-1...使用 MD 结构。

另一方面,如果某些哈希函数使用不同的结构,特别是在更广泛的运行状态下,则串联可能会产生更强大的函数。请参阅@Oli 的示例:如果所有四个函数都是 SHA-512,并对输出进行一些手术,那么串联的哈希函数可能是普通的 SHA-512。

关于四个哈希函数的串联唯一确定的是,结果的抗碰撞性不会低于四个哈希函数中最强的一个。这已在 SSL/TLS 中使用,直到版本 1.1,内部使用同时使用 MD5 和 SHA-1,以防止其中任何一个出现中断。

The classical article to read on that question is due to Hoch and Shamir. It builds on previous discoveries, especially by Joux. Bottom-line is the following: if you take four hash functions with a 128-bit output, and the four hash functions use the Merkle-Damgård construction, then finding a collision for the whole 512-bit ouput is no more difficult than finding a collision for one of the hash functions. MD5, SHA-1... use the MD construction.

On the other hand, if some of your hash functions use a distinct structure, in particular with a wider running state, the concatenation could yield a stronger function. See the example from @Oli: if all four functions are SHA-512 with some surgery on the output, then the concatenated hash function could be plain SHA-512.

The only sure thing about the concatenation of four hash functions is that the result will be no less collision-resistant than the strongest of the four hash functions. This has been used within SSL/TLS, which, up to version 1.1, internally uses concurrently both MD5 and SHA-1 in an attempt to resist breaks on either.

眼波传意 2024-12-11 19:12:42

512位就是512位。唯一的区别在于哈希值的缺陷不同。最好的整体哈希值是使用可用的最佳算法的 512。

编辑以添加说明,因为对于评论来说太长了:

理想的哈希将内容统一映射到 x 位。如果您有 4 个(完全独立的)x 位哈希值,则将文件统一映射到 4x 位; 4x 位散列仍然将同一文件统一映射到 4x 位。 4x 位就是 4x 位;只要它是完全一致的,无论它是来自 1 (4x) 个哈希函数还是 4 (x) 个哈希函数,都没有关系。然而,没有哈希可以是完全理想的,因此您需要最均匀的可获得分布,并且如果您使用 4 个不同的函数,则只有 1 个可以最接近最优,因此您有 x 个最优位和 3x 个次优位,而单个算法可以覆盖整个4x空间的最优分布。

我认为足够大的算法可能具有比单个 512 分布更均匀的位子集,并且可以组合起来以获得更多均匀性,但这似乎是一个很大的交易额外的研究和实施几乎没有潜在的好处。

512 bits is 512 bits. The only difference is in the difference in imperfections in the hashes. The best overall hash would be a 512 using the best algorithm available.

Edit to add clarification, because it's too long for a comment:

An ideal hash maps content uniformly onto x bits. If you have 4 (completely independent) x-bit hashes, that maps the file uniformly onto 4x bits; a 4x-bit hash still maps the same file uniformly onto 4x bits. 4x bits is 4x bits; as long as it's perfectly uniform, it doesn't matter whether it comes from one (4x) hash function or 4 (x). However, no hash can be completely ideal, so you want the most uniform obtainable distribution, and if you use 4 different functions, only 1 can be the closest to optimal so you have x optimal bits and 3x suboptimal, whereas a single algorithm can cover the entire 4x space with the most optimal distribution.

I suppose it is possible that enough larger algorithms could have subsets of bits that are more uniformly distributed than a single 512, and could be combined to get more uniformity, but that seems like it would be a great deal extra research and implementation for little potential benefit.

梦明 2024-12-11 19:12:42

如果您将连接四种不同的“理想”128 位哈希算法与一种理想的 512 位哈希算法进行比较,那么是的,这两种方法都会获得相同的冲突概率。不过,使用 md5 可以更轻松地破解哈希值。例如,如果攻击者知道您正在执行 md5 + md5 w/ salt + md5 与另一种盐.. 那么作为 md5 碰撞攻击,这将更容易破解。 查看此处了解有关已知攻击的哈希函数的更多信息。

If you are comparing concatenating four different 'ideal' 128bit hashing algorithms with one ideal 512 bit hashing algorithm, then yes, both methods will get you the same probability of a collision. Using md5 would make it easier to crack a hash though. If an attacker for example knew you were doing md5 + md5 w/ salt + md5 with another salt .. then that would be much easier to crack as md5 collision attack. Look here for more information about hash functions that have known attacks.

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