Is it possible to decrypt MD5 hashes? Explain.

Technology CommunityCategory: Web SecurityIs it possible to decrypt MD5 hashes? Explain.
VietMX Staff asked 3 years ago

No. MD5 is not encryption (though it may be used as part of some encryption algorithms), it is a one way hash function. Much of the original data is actually “lost” as part of the transformation.

Think about this: An MD5 is always 128 bits long. That means that there are 2128 possible MD5 hashes. That is a reasonably large number, and yet it is most definitely finite. And yet, there are an infinite number of possible inputs to a given hash function (and most of them contain more than 128 bits, or a measly 16 bytes). So there are actually an infinite number of possibilities for data that would hash to the same value. The thing that makes hashes interesting is that it is incredibly difficult to find two pieces of data that hash to the same value, and the chances of it happening by accident are almost 0.

MD5 has been found to have some weaknesses, such that with some complex mathematics, it may be possible to find a collision without trying out 2128 possible input strings. And the fact that most passwords are short, and people often use common values (like “password” or “secret”) means that in some cases, you can make a reasonably good guess at someone’s password by Googling for the hash or using a Rainbow table. That is one reason why you should always “salt” hashed passwords, so that two identical values, when hashed, will not hash to the same value.

Once a piece of data has been run through a hash function, there is no going back.