-1

i've read a paper about how hash algorithms word in general and i saw one strange thing.

MD5 input length is unlimited and the output length are always the same

so isn't that mean you can turn any large file into just 16 bytes? the only obstacle would be "How can you restore the data if you don't have the original data" i get this but isn't there a way to make a reversible hash function? if you can do this, it'll change how internet work actually an image of 10MB now is only 15 Byte you can compress a 10GB program into 16 byte. am i getting something wrong here?

2
  • 1
    Other than for the extremely high chance of a hash collision. MD5 cannot be reversed. 2 inputs can generate the same output.
    – Ramhound
    Apr 28, 2021 at 11:21
  • This might be a good question at Computer Science SE, as (AFAIK) there are actually mathematical limits to how far data can be compressed and still remain recoverable. (I mean, hash functions only work because they don't need the data to be recoverable, and often that's in fact the whole point.) Apr 28, 2021 at 11:49

1 Answer 1

1

Hashs are just special purpose fingerprints. If you have a print of my thumb you don't know how my face looks like. By checking the fingerprints is considered sufficient to compare people. Hashing is not compressing!

If you have two 2 bytes and a hash function with produces a one byte hash you will have on average 256 collisions (identical hashes). This is because 2 byte gives you 65536 different states as opposed to 256 states of a byte and 65536 states /256 states equals 256 repetitions of each hash state on average.

Because of this effect there is no interest to revert the hash to enumerate any possible input that might have produced a certain hash.

In case of so-called cryptographic hashes there is a special requirement: If an attacker manipulates a file of you he should no be able to do it in a way so that the hash of the file does not change.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .