Go to the documentation of this file.
233 ASSERT(start_bucket >= 0 && start_bucket <= end_bucket);
394 #define mix(a, b, c) \
396 a -= b; a -= c; a ^= (c>>13); \
397 b -= c; b -= a; b ^= (a<<8); \
398 c -= a; c -= b; c ^= (b>>13); \
399 a -= b; a -= c; a ^= (c>>12); \
400 b -= c; b -= a; b ^= (a<<16); \
401 c -= a; c -= b; c ^= (b>>5); \
402 a -= b; a -= c; a ^= (c>>3); \
403 b -= c; b -= a; b ^= (a<<10); \
404 c -= a; c -= b; c ^= (b>>15); \
408 hash_func(
const uint8_t *k, uint32_t length, uint32_t initval)
410 uint32_t a, b, c, len;
420 a += (k[0] + ((uint32_t) k[1] << 8)
421 + ((uint32_t) k[2] << 16)
422 + ((uint32_t) k[3] << 24));
423 b += (k[4] + ((uint32_t) k[5] << 8)
424 + ((uint32_t) k[6] << 16)
425 + ((uint32_t) k[7] << 24));
426 c += (k[8] + ((uint32_t) k[9] << 8)
427 + ((uint32_t) k[10] << 16)
428 + ((uint32_t) k[11] << 24));
439 c += ((uint32_t) k[10] << 24);
442 c += ((uint32_t) k[9] << 16);
445 c += ((uint32_t) k[8] << 8);
449 b += ((uint32_t) k[7] << 24);
452 b += ((uint32_t) k[6] << 16);
455 b += ((uint32_t) k[5] << 8);
461 a += ((uint32_t) k[3] << 24);
464 a += ((uint32_t) k[2] << 16);
467 a += ((uint32_t) k[1] << 8);
struct hash * hash_init(const int n_buckets, const uint32_t iv, uint32_t(*hash_function)(const void *key, uint32_t iv), bool(*compare_function)(const void *key1, const void *key2))
struct hash_element * next
static const char *const key1
bool hash_add(struct hash *hash, const void *key, void *value, bool replace)
struct hash_bucket * buckets
static void hash_iterator_lock(struct hash_iterator *hi, struct hash_bucket *b)
Container for unidirectional cipher and HMAC key material.
void hash_remove_by_value(struct hash *hash, void *value)
void hash_iterator_free(struct hash_iterator *hi)
uint32_t(* hash_function)(const void *key, uint32_t iv)
struct hash_element * hash_iterator_next(struct hash_iterator *hi)
static void hash_add_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv, void *value)
struct hash_element * list
struct hash_element * hash_lookup_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv)
struct hash_element * elem
static size_t adjust_power_of_2(size_t u)
void hash_iterator_delete_element(struct hash_iterator *hi)
void hash_iterator_init(struct hash *hash, struct hash_iterator *hi)
struct hash_bucket * bucket
static void hash_remove_marked(struct hash *hash, struct hash_bucket *bucket)
void hash_free(struct hash *hash)
static void hash_iterator_unlock(struct hash_iterator *hi)
bool hash_remove_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv)
#define ALLOC_OBJ_CLEAR(dptr, type)
static void hash_iterator_advance(struct hash_iterator *hi)
Container for bidirectional cipher and HMAC key material.
bool(* compare_function)(const void *key1, const void *key2)
struct hash_element * last
#define ALLOC_ARRAY(dptr, type, n)
uint32_t hash_func(const uint8_t *k, uint32_t length, uint32_t initval)
void hash_iterator_init_range(struct hash *hash, struct hash_iterator *hi, int start_bucket, int end_bucket)
static uint32_t hash_value(const struct hash *hash, const void *key)