Skip to main content

rapidhash_v2_inline

Function rapidhash_v2_inline 

Source
pub const fn rapidhash_v2_inline<const MINOR: u8, const AVALANCHE: bool, const COMPACT: bool, const PROTECTED: bool>(
    data: &[u8],
    secrets: &RapidSecrets,
) -> u64
Expand description

Rapidhash V2 a single byte stream, matching the C++ implementation.

Is marked with #[inline(always)] to force the compiler to inline and optimize the method. Can provide large performance uplifts for fixed-length inputs at compile time.

Compile time arguments:

  • MINOR: the minor version of the rapidhash algorithm:
    • 0: v2.0
    • 1: v2.1
    • 2: v2.2
  • AVALANCHE: Perform an extra mix step to avalanche the bits for higher hash quality. Enabled by default to match the C++ implementation.
  • COMPACT: Generates fewer instructions at compile time with less manual loop unrolling, but may be slower on some platforms. Disabled by default.
  • PROTECTED: Slightly stronger hash quality and DoS resistance by performing two extra XOR instructions on every mix step. Disabled by default.