Skip to main content

hash_chains_32_trunc16

Function hash_chains_32_trunc16 

Source
pub fn hash_chains_32_trunc16(
    mode: Mode<'_>,
    init: &[[u8; 32]],
    steps: u32,
    out: &mut [[u8; 16]],
)
Expand description

Evaluate init.len() independent 32-byte iterated hash chains in mode, advancing each chain by steps iterations and writing its final 16-byte state to out[i] (#584).

Each 32-byte input slot holds [prefix12 || start_step_u32_le || state16]. For each step s in 0..steps, state_{s+1} = H_mode(prefix12 || (start_step + s) || state_s)[..16] (modulo 2^32 on the step word). When steps == 0, out[i] receives init[i][16..32] unchanged.

Advances chains inside one fused kernel call across all steps iterations (18-lane 16-SME2 + 2-integer hybrid on Apple Silicon, 11-lane NEON 8+3, 16-lane AVX-512, 8-lane AVX2), keeping state in registers on AVX-512 and SME2 vector lanes (or L1 stack slots on AVX2, NEON, and scalar lanes) without caller-buffer copies or per-step smstart/smstop. Work depends only on init.len() and steps, never on keys or chain values.

Panics if init.len() != out.len() (checked in every build, even when steps == 0).