#include "splay_tree.h"
#include "control_common.h"
+#include "crypto.h"
#include "hash.h"
#include "logger.h"
#include "net.h"
uint32_t hash = hash_seed;
for(int i = 0; i < 4; i++) {
- hash += fullwidth[i];
+ hash = wrapping_add32(hash, fullwidth[i]);
hash = wrapping_mul32(hash, 0x9e370001U);
}
uint32_t hash = hash_seed;
for(int i = 0; i < 3; i++) {
- hash += halfwidth[i];
+ hash = wrapping_add32(hash, halfwidth[i]);
hash = wrapping_mul32(hash, 0x9e370001U);
}
/* Initialising trees */
void init_subnets(void) {
- hash_seed = (uint32_t)rand();
+ hash_seed = prng(UINT32_MAX);
// tables need to be cleared on startup
subnet_cache_flush_tables();