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. So is there any string that have same MD5 hash in PHP if I use hash('md5', $blablabla)
?
Asked
Active
Viewed 690 times
-3

Maarten Bodewes
- 90,524
- 13
- 150
- 263

DŨNG ĐỖ
- 11
- 2
-
1Do you have an actual programming question? Otherwise https://en.wikipedia.org/wiki/MD5#Collision_vulnerabilities – Jonnix Mar 20 '19 at 17:13
-
Possible duplicate of [Can two different strings generate the same MD5 hash code?](https://stackoverflow.com/questions/1756004/can-two-different-strings-generate-the-same-md5-hash-code) – Abdur Rehman Mar 20 '19 at 17:21
-
In terms of security this might interest you as well: https://www.whitehatsec.com/blog/magic-hashes/ It shows how some hashes can be bypassed when you aren't using a strict comparison in php. – SerAlejo Mar 20 '19 at 20:16
1 Answers
0
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.
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)

gusto2
- 11,210
- 2
- 17
- 36