libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
fnv1a.h File Reference
#include <cstdint>
#include <cstddef>
#include <promeki/core/namespace.h>
Include dependency graph for fnv1a.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PROMEKI_NAMESPACE_BEGIN constexpr uint64_t fnv1a (const char *s, uint64_t seed=0xcbf29ce484222325ULL)
 Computes the FNV-1a hash of a null-terminated string at compile time.
 
constexpr uint64_t fnv1aData (const void *data, size_t len, uint64_t seed=0xcbf29ce484222325ULL)
 Computes the FNV-1a hash of a block of data.
 

Detailed Description

See LICENSE file in the project root folder for license information.

Function Documentation

◆ fnv1aData()

constexpr uint64_t fnv1aData ( const void data,
size_t  len,
uint64_t  seed = 0xcbf29ce484222325ULL 
)
constexpr

Computes the FNV-1a hash of a block of data.

Iterates over a byte range and applies the FNV-1a mixing step to each byte. The function is constexpr for use in constant expressions.

Parameters
dataPointer to the input data.
lenLength of the input data in bytes.
seedInitial hash value (defaults to the FNV offset basis).
Returns
The 64-bit FNV-1a hash.