Start refactoring hashing.

This commit moves some of the hash datastructures and code from
util.cc into Hash.cc - where it seems more appropriate.

It also starts to make more Keyed hash functions available - still
using siphash as the default 64 bit keyed hash, but also making
128 and 256 bit highway hashes available.

There already are a few other functions that are defined but not
yet implemented - these will be "static" keyed hashes - which use
an installation specific key. These will be used to, e.g., get
rid of md5 hashing for the generation of file UIDs.
This commit is contained in:
Johanna Amann 2020-04-24 17:11:16 -07:00
parent d34532f847
commit 360c06a3f8
7 changed files with 123 additions and 67 deletions

View file

@ -3,6 +3,7 @@
#pragma once
#include "Hash.h"
#include "highwayhash/sip_hash.h"
#include <broker/expected.hh>
@ -24,7 +25,8 @@ public:
typedef hash_t digest;
typedef std::vector<digest> digest_vector;
struct seed_t {
alignas(16) highwayhash::HH_U64 h[2];
// actually HH_U64, which has the same type
alignas(16) unsigned long long h[2];
friend seed_t operator+(seed_t lhs, const uint64_t rhs) {
lhs.h[0] += rhs;