# Are there ANY text strings that will generate the same SHA-512 Hash output? [duplicate]

Are there ANY text strings that will generate the same SHA-512 Hash output? Please provide an example, and how you came to that conclusion.

I've tried thousands of variations, including ".." vs. "." and "..." vs "..,". I believe it IS possible, I just don't know HOW I can find those 2 magic text strings.

• Yes, but it's supposed to be hard to find an example. $\;$
– user991
Commented Aug 28, 2015 at 4:55
• You could do it, provided you checked all the possibilities. Count them, and you'll know. Commented Aug 28, 2015 at 5:07
• Typically similar strings will produce vastly different SHA hashes but it would be very interesting if there was a case where two similar strings produced the same hash Commented Aug 28, 2015 at 6:21
• Comments and answers use the phrase "hard to find". More accurate might be "possible in theory, but no-one has yet done it despite many attempts". Commented Aug 28, 2015 at 6:57
• Already answered at crypto.stackexchange.com/q/12301/351 and crypto.stackexchange.com/q/8765/351; see also crypto.stackexchange.com/q/301/351 and crypto.stackexchange.com/q/8092/351. In the future please make more of an effort to search for related questions here before posting a new one. Thank you!
– D.W.
Commented Aug 28, 2015 at 7:21

This is trivially true via the pigeonhole principle. SHA-2/512 has $2^{512}$ possible outputs, but $2^{2^{128}} - 1$ possible inputs. Trying $2^{512}+1$ unique inputs is sufficient to produce at least one collision.

That said, SHA-2/512 is designed to be collision resistant, which implies that it should be hard to find two inputs that hash to the same value. Finding a way to quickly create such a collision would be considered a catastrophic break in the algorithm.

Today it is considered unfeasible to even find one SHA-512 collision - none have been found so far. There have been efforts to find a collision for SHA-1 though (notably the IAIK "SHA-1-Collison Search Graz Project"); it is thought that the SHA-1 algorithm is sufficiently broken to find one. These attacks don't translate to SHA-512 because of the increased complexity of the algorithm and the higher output size of the hash.

• Added a paragraph about slowly finding a hash collision instead of "quickly* Commented Aug 28, 2015 at 8:55
• See this article about why finding such a collision is really, really unlikely. To just count from 0 to 2^512 would take much more energy then the whole universe is likely to contain.
– gnur
Commented Aug 28, 2015 at 9:01
• There isn't an infinite number of possible inputs. SHA-512 uses a 128 bit length field, which means it is undefined for inputs which are $2^{128}$ bits or longer. So the total number of possible inputs is $2^{2^{128}}-1$. Commented Aug 28, 2015 at 9:22
• Good point. I've edited the answer to reflect that. Commented Aug 28, 2015 at 17:09