Is md5 an injective function?

Is the md5 hash algorithm an injective function? that it will generate a unique output for any given input?

If not, is there another similar hash algorithm that is injective?

+4
source share
5 answers

No, MD5 has vocalists of conflicts . Other hash functions, such as SHA-1, also have hash collisions, although it is much less likely than MD5.

An injection hash function is also known as a perfect hash function . Ideal hash functions exist, but there are certain requirements or information that you need to know about the input data before you can find out that your hash is ideal.

You can look at CMPH for information on creating the perfect hash function.

+6
source

md5 is not an injective function because the output is less than the input, so you have more input than output.

I think sha-1 is not injective.

0
source

Here is another post that might answer your question.

Technically no, but kindly yes, because there is a very subtle chance for them to be the same.

Here is another post discussing this issue.

-1
source

Each hash function is NOT injective. Hashes map a large domain to much smaller code. According to the principle of a blue hole, such a function cannot be injective, since there will be elements in the domain that will be displayed on the same element in the codemon.

For example, providing a hash function to a large file as input and getting a short checksum. There are many more possible large files (pigeons) than there are possible short checksums (pigeon holes), so "collisions" will undoubtedly occur.

-1
source

Almost yes.

In fact, it has been shown to have potential for collisions. Instead, I would use SHA-1. 1

-2
source

Source: https://habr.com/ru/post/1390463/


All Articles