

SHA-1, which will take whatever as input. The perfect hash function is limited to that given list of strings unlike e.g. That's called an injective function in mathematics.Īs GNU gperf's documentation states, "For a given list of strings, it produces a hash function and hash table". It's guaranteed to be perfect, a collision is not possible because you are able to guarantee a unique hash for each of the input strings during the creation of the hash table and only them. To reiterate, they're mathematically perfect hash functions because they only create a limited amount of hashes due to them only taking in a specific amount of strings as input. If you can prove that the former can be perfect, then you have solved the hardest problem in computer science ever! The former cannot be perfect, but the latter can.

MD5 that accept any input string, to finite domain hash functions that take in specific amounts of input strings. You're comparing typical hash functions we see e.g.
