简体   繁体   English

相同的 MD5 哈希值但使用 hash('md5') 的不同输入

[英]Same MD5 hash value but different input using hash('md5')

I know that there is some case 2 different strings can have same MD5 hash but when I try with PHP it still become 2 different hash.我知道在某些情况下,2 个不同的字符串可以具有相同的 MD5 哈希值,但是当我尝试使用 PHP 时,它仍然会变成 2 个不同的哈希值。 So is there any string that have same MD5 hash in PHP if I use hash('md5', $blablabla) ?如果我使用hash('md5', $blablabla)那么在 PHP 中是否有任何字符串具有相同的 MD5 哈希值?

It is not that simple.事情没那么简单。

Indeed MD5 is considered as weak today and it is possible to find a collision (another input giving the same hash) under a minute.事实上,今天 MD5 被认为是弱的,有可能在一分钟内发现冲突(另一个输入给出相同的散列)。

Regardless that you have to compute the inputs, just guessing won't work.不管你必须计算输入,只是猜测是行不通的。 MD5 produces 128 bit output, so with random guessing will find collision with probability 1/(2^128) (almost impossible) MD5 产生 128 位输出,因此随机猜测会发现碰撞概率为 1/(2^128)(几乎不可能)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM