Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Does a Bloom Filter Need Multiple Hash Functions?

I don't really understand why a bloom filter requires multiple hash functions (say, SHA and MD5).

Why not just make a bigger SHA hash, for example, and then break it up into multiple parts and treat them as separate hashes? Isn't that more efficient in terms of speed?

like image 964
user541686 Avatar asked Aug 14 '26 12:08

user541686


2 Answers

The idea is to use several different but simple hash functions. If you're going to use some cryptographic hash function like SHA or MD5 then you could just vary the input to it. Whether it's more efficient depends how complex your hash functions are.

like image 198
gordy Avatar answered Aug 18 '26 06:08

gordy


It's called triple/double hashing, it minimizes the chance of collisions, probability of collision occurring with 5 hash functions, is 5 times smaller than with one hash function.

like image 28
TechEffigy Avatar answered Aug 18 '26 05:08

TechEffigy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!