Module util

Module util 

Source
Expand description

Miscellaneous helpers shared across all ntHash variants.

This module provides two small yet critical building blocks used by every ntHash implementation (NtHash, SeedNtHash, BlindNtHash, etc.):

  • canonical — combine forward and reverse‐complement hashes into a strand‐independent value by wrapping addition.
  • extend_hashes — generate a sequence of “extra” hash values from one canonical base hash, matching the C++ reference’s multiplicative mixing and shift scheme.

These functions are marked #[inline] for zero‐overhead calls in hot paths, and the code is dependency‐free (only core/std), so it can be used in no‐std contexts if needed.

Functions§

canonical
Combine forward and reverse‐complement strand hashes into a single canonical k‑mer hash (strand‐independent).
extend_hashes
Expand a single canonical hash into a user‐provided slice of additional hash values.