Is there an example of two known strings which have the same MD5 hash value (representing a so-called "MD5 collision")?


7 Answers 7


Yes you can, see at the MD5 Collision Demo, the two blocks:

d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89 
55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b 
d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0 
e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70


d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89 
55ad340609f4b30283e4888325f1415a 085125e8f7cdc99fd91dbd7280373c5b 
d8823e3156348f5bae6dacd436c919c6 dd53e23487da03fd02396306d248cda0 
e99f33420f577ee8ce54b67080280d1e c69821bcb6a8839396f965ab6ff72a70

produce an MD5 collision.

Each of these blocks has MD5 hash 79054025255fb1a26e4bc422aef54eb4.

  • 4
    $\begingroup$ Are there any 2 email addresses that you know, that will produce the same MD5 hash? I ask this because I know that Gravatar website uses MD5 as an identifier of accounts (here: en.gravatar.com/site/implement/images/java ) , which is done on email addresses. Since email addresses aren't bound by length, any function that operates on it and returns a limited string must have collisions. $\endgroup$ Commented Jul 25, 2019 at 19:41

Just to show you how easy it is today to create collisions on MD5:

One could create collisions using Marc Steven's HashClash on AWS and estimated the the cost of around $0.65 per collision.

These 2 images have the same md5 hash: 253dd04e87492e4fc3471de5e776bc3d

Ship image

Plane image

If you want to test it yourself and the images below do not give you the MD5 hash displayed above then you may need to take images from the original link below:

Reference: http://natmchugh.blogspot.com/2015/02/create-your-own-md5-collisions.html

  • 27
    $\begingroup$ Same hash and theme... $\endgroup$ Commented May 11, 2016 at 11:37
  • $\begingroup$ when i used the basic hash of mac's terminal, i get different results !! MD5 (image1.jpg) = d37ca5b7a8e39f810bc341616005fd0f MD5 (image2.jpg) = 6dbe9c815f73327fd10c3a5b0b3a7498 $\endgroup$
    – DeyaEldeen
    Commented Jul 23, 2017 at 16:18
  • 45
    $\begingroup$ @DeyaEldeen probably the images have been altered by stackexchange. Btw only looking at the pictures clearly shows there is a collision somewhere… ;-) $\endgroup$ Commented Aug 16, 2017 at 9:45
  • $\begingroup$ @DeyaEldeen The target hash is 253dd04e87492e4fc3471de5e776bc3d $\endgroup$
    – Déjà vu
    Commented Nov 29, 2021 at 5:34
  • 2
    $\begingroup$ I got the pictures downloaded directly from stackexchange and I can confirm the collision. Also, by inspecting the pictures I can also see the picture itself has "little" to do with the collision itself, since there's data after both pictures JPEG end marker (0xffd9), which the image renderer completely ignores but the md5 does not. So it's just adding some strings at the end of both files that don't affect the picture rendered until the collision is found. $\endgroup$
    – Azurlake
    Commented Sep 5, 2023 at 8:23

A new result shows how to generate single block MD5 collisions, including an example collision:

Message 1

Message 2

> md5sum message1.bin message2.bin
> 008ee33a9d58b51cfeb425b0959121c9 message1.bin
> 008ee33a9d58b51cfeb425b0959121c9 message2.bin

There is an earlier example of a single block collision, but the technique for generating it was not published.

  • 2
    $\begingroup$ I just saw it too on eprint and was about to post this one, but you beat me to that :) $\endgroup$
    – Jalaj
    Commented Jan 30, 2012 at 18:26

MD5 was intended to be a cryptographic hash function, and one of the useful properties for such a function is its collision-resistance. Ideally, it should take work comparable to around $2^{64}$ tries (as the output size is $128$ bits, i.e. there are $2^{128}$ different possible values) to find a collision (two different inputs hashing to the same output). (Actually, brute-forcing this is today almost in the range of possible, so this alone would be a reason not to use any small-output hash function like MD5.)

It showed that MD5 is not that resistant as intended, and nowadays it is relatively easy to produce more collisions, even with an arbitrary common prefix and suffix.

There was a spectacular example, when someone used an MD5 collision to get a fake SSL certificate from a certification agency. The agency signed a certificate for a domain which belonged to the attacker, and the attacker produced a different certificate (for another domain) with the same hash, i.e. for which the same signature was valid.

Don't use MD5 for any application which relies on collision-resistance (like signatures) ... or for any new application at all. Use SHA-2 (or SHA-3) now.

  • $\begingroup$ Or use Blake2b. Faster and more secure. $\endgroup$
    – Demi
    Commented Mar 24, 2016 at 2:21
  • 6
    $\begingroup$ @Demetri while faster can be easily proven (on specific hardware), is there a proof of it being more secure (if it's twice as fast it might be twice as insecure from a brute-force attack)? The most analysis goes into the most-widely used crypto functions trying to break them, so it doesn't always seem a fair comparison. $\endgroup$
    – Nick T
    Commented Jul 25, 2016 at 22:12
  • $\begingroup$ Just adding this link Is Blake better (2017), that may be relevant to the discussion (see SHA-2 near the bottom). $\endgroup$
    – Déjà vu
    Commented Nov 29, 2021 at 5:29
  1. Two different strings in hex format:


    both have MD5 hash:



    > md5sum message1.bin message2.bin
    008ee33a9d58b51cfeb425b0959121c9 message1.bin
    008ee33a9d58b51cfeb425b0959121c9 message2.bin
    > sha1sum message1.bin message2.bin
    c6b384c4968b28812b676b49d40c09f8af4ed4cc message1.bin
    c728d8d93091e9c7b87b43d9e33829379231d7ca message2.bin
  2. Another example (in hex):


    both have MD5 hash:


Example 1. is straight from Marc Stevens: Single-block collision for MD5, 2012; he explains his method, with source code (alternate link to the paper).

Example 2. is adapted from Tao Xie and Dengguo Feng: Construct MD5 Collisions Using Just A Single Block Of Message, 2010.

Please note that above examples are hexadecimal representation of the strings. So to test it, you've to write these hex values into the binary files and then compare them as shown above.

To make simple test in shell, please check the commands provided in: Can two different strings generate the same MD5 hash code?

See also: What is the MD5 collision with the smallest input values?

  • 15
    $\begingroup$ For those who can't squint: The 18th-to-last character in 1 is different 555 and d55 and in 2 it's somewhere in the middle of first row 659e744 and 659e704 $\endgroup$
    – rath
    Commented Apr 29, 2014 at 14:49
  • $\begingroup$ whe I try it here I don't get the same hash: md5.cz $\endgroup$
    – RicardoE
    Commented May 6, 2014 at 3:52
  • 4
    $\begingroup$ In response to others saying they're not getting the same MD5 hash, the data is in hex format and must be converted to binary format. Here's an example in PHP: ideone.com/UyP22Z $\endgroup$ Commented Mar 7, 2016 at 21:24
  • 2
    $\begingroup$ @ub3rst4r If you've got python, just type this: hashlib.md5(bytearray.from_hex("STRING HERE")).digest() $\endgroup$
    – Zizouz212
    Commented Aug 22, 2016 at 21:47
  • 1
    $\begingroup$ Or this tool supports also HEX input: decrane.io/md5 $\endgroup$ Commented Jan 31, 2017 at 19:47

Here are some other interesting examples. One of them is, two downloadable executables that have the same MD5 hash, but are actually different, and produce different (safe) results when run!

So much for using MD5 hashes to ensure download file integrity :-(



From "Schneier on Security", March 10, 2005…

More Hash Function Attacks

Here's(1) a pair of valid X.509 certificates that have identical signatures. The hash function used is MD5.

And here's a paper(2) demonstrating a technique for finding MD5 collisions quickly: eight hours on 1.6 GHz computer.


  1. http://www.win.tue.nl/~bdeweger/CollidingCertificates/
  2. http://cryptography.hyperlink.cz/md5/MD5_collisions.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.