md5 - 如果我传入2^32组字符串,md5碰撞的概率是多少?

标签 md5

如果我传入2^32组字符串,md5冲突的概率是多少?

我可以说答案就是 2^32/2^128 = 1/1.2621774e-29 因为 md5 哈希的位长度是 128 吗?

最佳答案

这个问题类似于所谓的"birthday paradox" .

In probability theory, the birthday problem or birthday paradox concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday. By the pigeonhole principle, the probability reaches 100% when the number of people reaches 367 (since there are 366 possible birthdays, including February 29). However, 99% probability is reached with just 57 people, and 50% probability with 23 people. These conclusions are based on the assumption that each day of the year (except February 29) is equally probable for a birthday.

The mathematics behind this problem led to a well-known cryptographic attack called the birthday attack, which uses this probabilistic model to reduce the complexity of cracking a hash function.

根据维基百科文章,从 d = 2 的空间中选择 n = 232 个随机数时发生碰撞的几率128 数字大约为:

Generalized birthday problem math

如果您work this calculation out几率约为 2.7×10-20。这是一个非常小的概率,但请注意,它比您建议的计算高 9 个数量级。

关于md5 - 如果我传入2^32组字符串,md5碰撞的概率是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14973197/

相关文章:

c# - 如何从整数生成 MD5 哈希(32/64 个字符)

javascript ->> 运算符/操作数/修饰符的作用是什么?

javascript - 生成 JSON 的 md5 哈希并在 Python 和 JavaScript 中进行比较

php - 使用 php 创建一个 joomla 用户密码?

python - 解密 MD5 哈希

python - 如果字符无效则删除行

shell - unix 环境中最快的散列?

php - 为什么我的哈希值总是全 0?

testing - 您会编写哪些测试来验证 MD5 实现的正确性?

php - 如何将 md5 字符串转换为普通文本?