is it possible that hash function produces the same hash value for two different inputs?

2.8k Views Asked by At

is it possible that hash function produces the same hash value for two different inputs ? I am not mistaken I have read that hash function is one way encryption, so we cannot go back to the input using the result, and read that even if we change a bit of the ducoment that is directed to be hadhed will give another hash value, so how does collusion happen? and how is it possible for a hash function to produce the same value for two different inputs?

1

There are 1 best solutions below

0
Marty Pauley On

Yes. The range of any hash function is limited by the number of bits. For example, if we were to use a hash function outputting 8 bits, then we only have 256 possible outputs; so if we have more than 256 possible inputs then we are guaranteed to have a collision.

If we use a hash function with a larger range then it becomes much less likely to have a collision; but cannot make it impossible because our inputs are unlimited.

The existence of collisions is part of the reason why these functions are one way: a given output could have been generated from an unlimited number of different inputs.

We should also use a good cryptographic hash function to help avoid collisions from similar input.

You may want to look at the "SHAttered" example of 2 different PDF files that have the same SHA1 hash.