Changing the Bloom filter hashing so that it's independent of

CompositeHash.

We do this by hashing values added to a BloomFilter another time more
with a stable hash seeded only by either the filter's name or the
global_hash_seed (or Bro's random() seed if neither is defined).

I'm also adding a new bif bloomfilter_internal_state() that returns a
string representation of a Bloom filter's current internal state. This
is solely for writing tests that check that the filters end up
consistent when seeded with the same value.
This commit is contained in:
Robin Sommer 2013-07-31 17:14:02 -07:00
parent 6c197fbebf
commit 2a0790c231
14 changed files with 157 additions and 59 deletions

View file

@ -31,6 +31,11 @@ size_t Hasher::MakeSeed(const void* data, size_t size)
return *reinterpret_cast<size_t*>(buf); // Use the first bytes as seed.
}
Hasher::digest_vector Hasher::Hash(const HashKey* key) const
{
return Hash(key->Key(), key->Size());
}
bool Hasher::Serialize(SerialInfo* info) const
{
return SerialObj::Serialize(info);
@ -77,7 +82,6 @@ Hasher::Hasher(size_t arg_k, size_t arg_seed)
seed = arg_seed;
}
UHF::UHF(size_t seed)
: h(seed)
{