17 #include "ext/siphash.h"
22 #define N_BITS_PER_ITEM (BLOOMFILT_N_HASHES * 2)
34 #define BIT(set, n) ((n) & (set)->mask)
43 uint64_t h = set->
hashfn(&set->
key[i], item);
44 uint32_t high_bits = (uint32_t)(h >> 32);
45 uint32_t low_bits = (uint32_t)(h);
59 uint64_t h = set->
hashfn(&set->
key[i], item);
60 uint32_t high_bits = (uint32_t)(h >> 32);
61 uint32_t low_bits = (uint32_t)(h);
79 bloomfilt_hash_fn hashfn,
80 const uint8_t *random_key)
92 int n_bits = 1u << (
tor_log2(max_elements)+5);
98 memcpy(r->
key, random_key,
sizeof(r->
key));
111 bitarray_free(set->
ba);
static void bitarray_set(bitarray_t *b, int bit)
static unsigned int bitarray_is_set(bitarray_t *b, int bit)
static bitarray_t * bitarray_init_zero(unsigned int n_bits)
int tor_log2(uint64_t u64)
void bloomfilt_add(bloomfilt_t *set, const void *item)
int bloomfilt_probably_contains(const bloomfilt_t *set, const void *item)
bloomfilt_t * bloomfilt_new(int max_elements, bloomfilt_hash_fn hashfn, const uint8_t *random_key)
void bloomfilt_free_(bloomfilt_t *set)
#define BLOOMFILT_N_HASHES
#define BLOOMFILT_KEY_LEN
Headers for util_malloc.c.
struct sipkey key[BLOOMFILT_N_HASHES]
Macros to manage assertions, fatal and non-fatal.