Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MD5 Inverse Identity: Does (X,Y) exist such that md5(X)=Y and md5(Y)=X

Tags:

hash

md5

Do there exist two 128-bit values that hash to each other?

Find (X,Y) such that md5(X) = Y and md5(Y) = X

can they be found without brute force?

For extra credit: Am I allowed to make up the term "md5-itive inverse identity?"

The solution set will be sparse, if not empty.

For your LOL's today, here ya go:

https://github.com/flipmcf/playground/tree/master/md5-inverse-search

Related:

MD5 Fixed Point
MD5 Hash Collisions

like image 679
FlipMcF Avatar asked Jun 03 '09 19:06

FlipMcF


People also ask

Can MD5 hashes be the same?

Generally, two files can have the same md5 hash only if their contents are exactly the same. Even a single bit of variation will generate a completely different hash value. There is one caveat, though: An md5 sum is 128 bits (16 bytes).

Is MD5 evenly distributed?

Another benefit of using a hashing algorithm like MD5 is that the resulting hashes have a known even distribution, meaning your ids will be evenly distributed without worrying about keeping the id values themselves evenly distributed. So that's not bad at all; less than a percent over/under for distribution per node.

What is padding in MD5?

Padding means adding extra bits to the original message. So in MD5 original message is padded such that its length in bits is congruent to 448 modulo 512. Padding is done such that the total bits are 64 less, being a multiple of 512 bits length.

Is MD5 hash deterministic?

Yes MD5 is deterministic, and this is considered a desirable characteristic for many applications of message digest functions.


1 Answers

(Both answers were found while reading this link)...

To answer question (1), consider the following:

Brute forcing all md5(x)=x means checking 2.4x10^38 values. My quick test implementation can test some 2.3x10^9 values per hour, meaning it would take almost exactly 10^29 hours to brute force it. Let's say I get a million people to help me out, then we're down to 10^23 years.. And let's say the algorithm gets a million times faster with some clever optimization, and we're down to 10^17 years. And let's pretend computers get a million times faster over night, and we're down to 10^11 years, which is significantly longer than the universe has existed for.

I would imagine the above could be culled faster with some smart force algorithm†.

To answer question (2), the following two blocks have the same md5 hash:

d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89
55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b
d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0
e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70

and

d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89
55ad340609f4b30283e4888325f1415a 085125e8f7cdc99fd91dbd7280373c5b
d8823e3156348f5bae6dacd436c919c6 dd53e23487da03fd02396306d248cda0
e99f33420f577ee8ce54b67080280d1e c69821bcb6a8839396f965ab6ff72a70

6 bytes differ between the two blocks (bytes 39, 91, 119, 167, 219, and 247), and the hash is 79054025255fb1a26e4bc422aef54eb4. I would imagine the blocks were discovered by some kind of smart force algorithm†, though I don't know for sure.

†: brute force taking into account the analyzed weaknesses of md5

like image 144
fbrereto Avatar answered Oct 04 '22 18:10

fbrereto