Ultra 0.9.4
Loading...
Searching...
No Matches
hash_t.h File Reference
#include "utility/assert.h"
#include <algorithm>
#include <array>
#include <bit>
#include <concepts>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <span>

Go to the source code of this file.

Classes

struct  ultra::hash_t
class  ultra::murmurhash3
class  ultra::murmurhash3_sink

Namespaces

namespace  ultra

Typedefs

using ultra::hash = murmurhash3
using ultra::hash_sink = murmurhash3_sink

Functions

std::ostream & ultra::operator<< (std::ostream &o, hash_t h)
std::uint64_t ultra::internal::fmix (std::uint64_t k) noexcept
std::uint32_t ultra::internal::fmix (std::uint32_t k) noexcept
void ultra::internal::finalize (hash_t &h, std::size_t total_len) noexcept
void ultra::internal::process_block (hash_t &h, std::uint64_t k1, std::uint64_t k2) noexcept
void ultra::internal::process_tail (hash_t &h, const std::byte *tail, std::size_t len) noexcept
template<std::unsigned_integral T>
T ultra::internal::load_unaligned (const std::byte *p) noexcept
template<class T>
requires (std::integral<T> || std::floating_point<T>)
std::span< const std::byte, sizeof(T)> ultra::bytes_view (const T &t) noexcept
std::span< const std::byte > ultra::bytes_view (const std::string &s) noexcept

Variables

constexpr std::size_t ultra::internal::murmurhash3_block_size {16}

Detailed Description

Remarks
This file is part of ULTRA.
License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/

Function Documentation

◆ finalize()

void ultra::internal::finalize ( hash_t & h,
std::size_t total_len )
inlinenoexcept

Finalises the hash state after all input has been processed.

Parameters
[in,out]hcurrent hash state
[in]total_lentotal length of the input, in bytes

This step incorporates the message length and applies the final avalanche mixing to produce the final 128-bit hash value.

◆ process_block()

void ultra::internal::process_block ( hash_t & h,
std::uint64_t k1,
std::uint64_t k2 )
inlinenoexcept

Mixes a single 128-bit block into the hash state.

Parameters
[in,out]hcurrent hash state
[in]k1first 64-bit block
[in]k2second 64-bit block

This function corresponds to the body mixing step of the MurmurHash3 x64 128-bit algorithm.

◆ process_tail()

void ultra::internal::process_tail ( hash_t & h,
const std::byte * tail,
std::size_t len )
inlinenoexcept

Processes the remaining tail bytes (0–15) of the input.

Parameters
[in,out]hcurrent hash state
[in]tailpointer to the remaining bytes
[in]lennumber of valid bytes in tail

This implements the exact tail-handling logic defined by the MurmurHash3 x64 128-bit reference implementation.