mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Move all of the hashing classes/functions to zeek::detail namespace
This commit is contained in:
parent
93948b4d19
commit
a2a435360a
40 changed files with 289 additions and 234 deletions
|
@ -19,30 +19,30 @@ Hasher::seed_t Hasher::MakeSeed(const void* data, size_t size)
|
|||
{
|
||||
u_char buf[SHA256_DIGEST_LENGTH];
|
||||
seed_t tmpseed;
|
||||
EVP_MD_CTX* ctx = hash_init(Hash_SHA256);
|
||||
EVP_MD_CTX* ctx = zeek::detail::hash_init(zeek::detail::Hash_SHA256);
|
||||
|
||||
assert(sizeof(tmpseed) == 16);
|
||||
|
||||
static auto global_hash_seed = zeek::id::find_val<zeek::StringVal>("global_hash_seed");
|
||||
|
||||
if ( data )
|
||||
hash_update(ctx, data, size);
|
||||
zeek::detail::hash_update(ctx, data, size);
|
||||
|
||||
else if ( global_hash_seed->Len() > 0 )
|
||||
hash_update(ctx, global_hash_seed->Bytes(), global_hash_seed->Len());
|
||||
zeek::detail::hash_update(ctx, global_hash_seed->Bytes(), global_hash_seed->Len());
|
||||
|
||||
else
|
||||
{
|
||||
unsigned int first_seed = initial_seed();
|
||||
hash_update(ctx, &first_seed, sizeof(first_seed));
|
||||
zeek::detail::hash_update(ctx, &first_seed, sizeof(first_seed));
|
||||
}
|
||||
|
||||
hash_final(ctx, buf);
|
||||
zeek::detail::hash_final(ctx, buf);
|
||||
memcpy(&tmpseed, buf, sizeof(tmpseed)); // Use the first bytes as seed.
|
||||
return tmpseed;
|
||||
}
|
||||
|
||||
Hasher::digest_vector Hasher::Hash(const HashKey* key) const
|
||||
Hasher::digest_vector Hasher::Hash(const zeek::detail::HashKey* key) const
|
||||
{
|
||||
return Hash(key->Key(), key->Size());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue