How To Convert Crypt To Md5?

Does a MD5 algorithm convert an input of any length to a 128 bit output? If so, can we compress several kilobytes into 128 bits?

  • Answer:

    Even if you use something like that to "compress" something, how will you "decompress" it? Things like md5/sha are one way, you cannot unhash a hash.

Aashish Tripathee at Quora Visit the source

Was this solution helpful to you?

Other answers

Yes, but you can't get the data back out again. This is still useful; for example, Dropbox does a cheap hash comparison to see if it has the latest version of a document (comparing the entire file would be much more expensive).

Jonathan Paulson

Yes and no in that order, I'm not sure compress is a word I would use for this, but MD5 can seem a bit complicated, so let's look at something simpler. Let us say that we're silently passing notes in the rain (oh, just pretend), and I send you one with 134 on. In my kind of handwriting that can easily look like 188 if water has smudged the lines just a little, so to make sure you can tell whether that has happened, I'm also going to send a note with an 8 on, for checking. That works if we agree that 1+3+4 is 8 but 1+8+8 is 17, so if you read a smudged 188, or 138, or even 184, you'll know that they're all wrong, because the digits don't match the http://en.wikipedia.org/wiki/Checksum. If you want a checksum of fixed, short length, we could continue doing digit sums of the digit sums until the result is a single digit, but that way 188 gives 17 gives 8, and that's a collision with the 8 we had for 134, so now you can't tell those apart any more. Continuing with this reckless information-discarding method, we can cram every natural number into the single-digit range, but it's not a compression without loss, because when you're done with a number, you have no way to get it back from just the checksum again. MD5 is like that. The reason it is more complicated to calculate, is that it has been painstakingly crafted to make sure that you have to mangle the original number so badly to get a collision that it practically doesn't happen by accident, and is hard to do even if you try it on purpose.

Jan Christian Meyer

Not if you expect to be able to "decompress" it. MD5 is a hash function and a hash function very deliberately is a one-way function. Given the 128 bit output, there is no sensible way to find the input that was originally used. This might illustrate why: Since the output of MD5 is always 128 bits, there is a maximum of 2^128 possible outputs. However, you can theoretically use any of infinite number of inputs into MD5. Hence, by the pigeonhole principle there exists at least one of the outputs which have an INFINITE number corresponding inputs. If you expect MD5 to be balanced at all, you'd expect just about any valid output to have many, many corresponding inputs. Who is to say which of these was the desired input?

Alexander Phipps

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.