Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Dec 11 '11 at 14:22

This question came from our site for professional and enthusiast programmers.

Example in Wikipedia. – Tomasz Nurkiewicz Dec 11 '11 at 9:04
Welcome to Cryptography Stack Exchange. Your question was migrated here because of being not directly related to software development (the topic of Stack Overflow), and being fully on-topic here. Please register your account here, too, to be able to comment. – Paŭlo Ebermann Dec 11 '11 at 14:23
Once wrote two bash script that got the same MD5 value, and did two different things none-the-less. Pretty easy to do, but McAfee ate the .zip as a proto-virus was stored in it as well (you can create a .zip scanner but not one that can delete the files from the .zip, pretty lame). – Maarten Bodewes May 6 '14 at 23:43

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.

share|improve this answer

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 not technique for generating it was published.

share|improve this answer
I just saw it too on eprint and was about to post this one, but you beat me to that :) – Jalaj Jan 30 '12 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 now.

share|improve this answer
Or use Blake2b. Faster and more secure. – Demetri Mar 24 at 2:21
  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?

share|improve this answer
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 – rath Apr 29 '14 at 14:49
whe I try it here I don't get the same hash: – RicardoE May 6 '14 at 3:52
It's because these are hexadecimal representation of the strings. You've to save them into two separate files and run md5sum message1.bin message2.bin. See example: – kenorb May 6 '14 at 14:20
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: – ub3rst4r Mar 7 at 21:24

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 :-(

share|improve this answer

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.


share|improve this answer

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

enter image description here

enter image description here

(If you want to test it yourself, take images from the link below, after uploading them to SE it seems like some of the metadata or something is changed that makes the hashes different)


share|improve this answer
Same hash and theme... – Matas Vaitkevicius May 11 at 11:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.