File include/brisk/core/Hash.hpp
¶
crc32
function¶
uint32_t crc32(bytes_view data, uint32_t crc = 0)
Computes the CRC-32 checksum.
Param data
The data to calculate the checksum for.
Param crc
The initial CRC value (default is 0).
Returns The CRC-32 checksum.
inline uint32_t crc32(std::string_view data,
uint32_t crc = 0)
Computes the CRC-32 checksum for a string.
Param data
The string to calculate the checksum for.
Param crc
The initial CRC value (default is 0).
Returns The CRC-32 checksum.
fastHash
function¶
uint64_t fastHash(bytes_view data, uint64_t seed = 0)
Computes a fast hash for strings and byte arrays.
Param data
The data to hash.
Param seed
The initial hash seed (default is 0).
Returns The computed hash.
template <typename C, typename Tr>
inline uint64_t fastHash(std::basic_string_view<C, Tr> data,
uint64_t seed = 0)
Computes a fast hash for basic string views.
Param data
The string view to hash.
Param seed
The initial hash seed (default is 0).
Returns The computed hash.
template <typename C, typename Tr, typename Al>
inline uint64_t
fastHash(const std::basic_string<C, Tr, Al> &data,
uint64_t seed = 0)
Computes a fast hash for basic strings.
Param data
The string to hash.
Param seed
The initial hash seed (default is 0).
Returns The computed hash.
template <typename T>
inline uint64_t fastHash(const T &data, uint64_t seed = 0)
requires(simpleMemoryRepresentation<T>)
Computes a fast hash for data types with a simple memory representation.
Template param T
Data type.
Param data
The data to hash.
Param seed
The initial hash seed (default is 0).
Returns The computed hash.
fastHashTuple
function (Internal::fastHashTuple
)¶
template <size_t... I, typename... T>
inline uint64_t fastHashTuple(size_constants<I...>,
const std::tuple<T...> &data,
uint64_t seed)
Computes a fast hash for a tuple.
Param data
The tuple to hash.
Param seed
The initial hash seed.
Returns The computed hash.
fastHash
function¶
template <typename... T>
inline uint64_t fastHash(const std::tuple<T...> &data,
uint64_t seed = 0)
requires(!simpleMemoryRepresentation<std::tuple<T...>>)
Computes a fast hash for tuples.
Param data
The tuple to hash.
Param seed
The initial hash seed (default is 0).
Returns The computed hash.
fastHashAccum
function¶
template <typename T>
inline void fastHashAccum(uint64_t &seed, const T &data)
Updates the seed with the hash of a given data element.
Template param T
Data type.
Param seed
The current hash seed.
Param data
The data to hash and accumulate.
FastHash
class¶
FastHash
Functor for computing fast hashes.
Template param T
Data type.
Param value
The value to hash.
Returns The computed hash.
StringHash
class¶
StringHash
Functor for computing hashes of strings. Supports transparent comparisons for heterogenous lookups.
reflectHash
function (Internal::reflectHash
)¶
template <size_t... indices, typename T, typename Class,
typename... FieldType>
uint64_t reflectHash(
uint64_t seed, size_constants<indices...>, const T &val,
const std::tuple<ReflectionField<Class, FieldType>...>
&fields)
Computes a hash for an object using its reflected fields.
This function iterates over the fields of an object (as defined by its reflection metadata)
and accumulates a hash for each field.
Template param indices
The indices of the fields in the reflection tuple.
Template param T
The type of the object being hashed.
Template param Class
The class type containing the fields.
Template param FieldType
The types of the fields being reflected.
Param seed
The initial seed for the hash.
Param val
The object whose fields are being hashed.
Param fields
The tuple of ReflectionField
objects representing the fields.
Returns The accumulated hash value.
fastHash
function¶
template <HasReflection T>
uint64_t fastHash(const T &val, uint64_t seed = 0)
requires(!simpleMemoryRepresentation<T>)
Computes a fast hash for an object using reflection metadata.
This function calculates a hash for an object by hashing each of its fields, as defined
by its reflection metadata. The function is only enabled for types that do not have
a simple memory representation.
Template param T
The type of the object being hashed.
Param val
The object to hash.
Param seed
The initial seed for the hash (default is 0).
Returns The hash value of the object.
Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/