Search code examples
hashhash-functionbloom-filter

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?


Solution

  • 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.