diff options
Diffstat (limited to 'src/libsystemd/sd-bus/bus-bloom.h')
-rw-r--r-- | src/libsystemd/sd-bus/bus-bloom.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-bloom.h b/src/libsystemd/sd-bus/bus-bloom.h index 422eb4e01a..0dad5db78d 100644 --- a/src/libsystemd/sd-bus/bus-bloom.h +++ b/src/libsystemd/sd-bus/bus-bloom.h @@ -23,7 +23,21 @@ #include <sys/types.h> -#define BLOOM_SIZE 64 - -void bloom_add_pair(uint64_t filter[BLOOM_SIZE/8], const char *a, const char *b); -void bloom_add_prefixes(uint64_t filter[BLOOM_SIZE/8], const char *a, const char *b, char sep); +/* + * Our default bloom filter has the following parameters: + * + * m=512 (bits in the filter) + * k=8 (hash functions) + * + * We use SipHash24 as hash function with a number of (originally + * randomized) but fixed hash keys. + * + */ + +#define DEFAULT_BLOOM_SIZE (512/8) /* m: filter size */ +#define DEFAULT_BLOOM_N_HASH 8 /* k: number of hash functions */ + +void bloom_add_pair(uint64_t filter[], size_t size, unsigned n_hash, const char *a, const char *b); +void bloom_add_prefixes(uint64_t filter[], size_t size, unsigned n_hash, const char *a, const char *b, char sep); + +bool bloom_validate_parameters(size_t size, unsigned n_hash); |