Replace siphash with Google implementation

This adds the entirety of the highwayhash implementation of Google.
This includes siphash as well as severl highwayhash variants - which
are faster.

This first commit only switches out the siphash implementation. All
hashes that are generated are exactly the same as before. However, this
does make all other hashes available to be used by us.

I did some performance tests vs the previous siphash implementation by
running the 2009-M57-day11-18 trace 100x through both cases. The average
runtime was virtually the same (within 0.014 seconds of each other).

Note that the way that I included the highwayhash implementation in our
cmake setup is... well, let's say hacky. This definitely needs to be
changed a bit before including this in a real build.
This commit is contained in:
Johanna Amann 2020-04-22 19:08:20 -07:00
parent 6e2cd3ae44
commit 3937fff57f
10 changed files with 46 additions and 164 deletions

View file

@ -25,9 +25,9 @@
#include <stdarg.h>
#include <libgen.h>
#include <memory> // std::unique_ptr
#include "highwayhash/sip_hash.h"
#include "zeek-config.h"
#include "siphash24.h"
#ifdef DEBUG
@ -203,7 +203,7 @@ extern std::string strstrip(std::string s);
extern bool hmac_key_set;
extern uint8_t shared_hmac_md5_key[16];
extern bool siphash_key_set;
extern uint8_t shared_siphash_key[SIPHASH_KEYLEN];
extern highwayhash::SipHashState::Key shared_siphash_key;
extern void hmac_md5(size_t size, const unsigned char* bytes,
unsigned char digest[16]);