mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
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:
parent
6e2cd3ae44
commit
3937fff57f
10 changed files with 46 additions and 164 deletions
|
@ -21,7 +21,7 @@
|
|||
#include "Reporter.h"
|
||||
#include "BroString.h"
|
||||
|
||||
#include "siphash24.h"
|
||||
#include "highwayhash/sip_hash.h"
|
||||
|
||||
void init_hash_function()
|
||||
{
|
||||
|
@ -158,8 +158,7 @@ hash_t HashKey::HashBytes(const void* bytes, int size)
|
|||
{
|
||||
if ( size <= UHASH_KEY_SIZE )
|
||||
{
|
||||
hash_t digest;
|
||||
siphash(&digest, (const uint8_t *)bytes, size, shared_siphash_key);
|
||||
hash_t digest = highwayhash::SipHash(shared_siphash_key, reinterpret_cast<const char *>(bytes), size);
|
||||
return digest;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue