wyhash.h
Go to the documentation of this file.
1 // Copyright 2020 The Abseil Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // This file provides the Google-internal implementation of the Wyhash
16 // algorithm.
17 //
18 // Wyhash is a fast hash function for hash tables, the fastest we've currently
19 // (late 2020) found that passes the SMHasher tests. The algorithm relies on
20 // intrinsic 128-bit multiplication for speed. This is not meant to be secure -
21 // just fast.
22 
23 #ifndef ABSL_HASH_INTERNAL_WYHASH_H_
24 #define ABSL_HASH_INTERNAL_WYHASH_H_
25 
26 #include <stdint.h>
27 #include <stdlib.h>
28 
29 #include "absl/base/config.h"
30 
31 namespace absl {
33 namespace hash_internal {
34 
35 // Hash function for a byte array. A 64-bit seed and a set of five 64-bit
36 // integers are hashed into the result.
37 //
38 // To allow all hashable types (including string_view and Span) to depend on
39 // this algorithm, we keep the API low-level, with as few dependencies as
40 // possible.
41 uint64_t Wyhash(const void* data, size_t len, uint64_t seed,
42  const uint64_t salt[5]);
43 
44 } // namespace hash_internal
46 } // namespace absl
47 
48 #endif // ABSL_HASH_INTERNAL_WYHASH_H_
seed
static const uint8_t seed[20]
Definition: dsa_test.cc:79
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition: third_party/abseil-cpp/absl/base/config.h:171
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition: third_party/abseil-cpp/absl/base/config.h:170
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
stdint.h
absl::hash_internal::data
static char data[kDataSize]
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/city_test.cc:32
absl::hash_internal::Wyhash
uint64_t Wyhash(const void *data, size_t len, uint64_t seed, const uint64_t salt[])
Definition: wyhash.cc:30
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:53