Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::murmurhash3_sink Class Reference

#include <hash_t.h>

Public Member Functions

 murmurhash3_sink (std::uint32_t=1973) noexcept
void write (std::span< const std::byte >) noexcept
hash_t final () noexcept

Detailed Description

Incremental MurmurHash3 x64 128-bit sink.

This class allows hashing a byte stream incrementally, producing a 128-bit MurmurHash3 signature equivalent to hashing the entire input in a single call to murmurhash3::hash128.

It's designed to act as a byte sink for streaming algorithms such as gp::individual::pack, avoiding temporary buffers and repeated hashing.

Constructor & Destructor Documentation

◆ murmurhash3_sink()

ultra::murmurhash3_sink::murmurhash3_sink ( std::uint32_t seed = 1973)
inlineexplicitnoexcept

Constructs a new incremental MurmurHash3 sink.

Parameters
[in]seedinitial seed value (default: 1973)

Member Function Documentation

◆ final()

hash_t ultra::murmurhash3_sink::final ( )
inlinenodiscardnoexcept

Finalises the hash computation and returns the resulting signature.

Returns
the 128-bit MurmurHash3 value corresponding to the input stream
Warning
Calling this function finalises the internal state. Further calls to write() result in undefined behaviour.

◆ write()

void ultra::murmurhash3_sink::write ( std::span< const std::byte > bytes)
inlinenoexcept

Feeds a sequence of bytes into the hash state.

Parameters
[in]bytesbyte span to be hashed

This function may be called multiple times with arbitrary chunk sizes. The resulting hash is identical to hashing the concatenation of all provided byte sequences in a single call.


The documentation for this class was generated from the following file: