Skip to main content

blake3_keyed_fixed

Function blake3_keyed_fixed 

Source
pub fn blake3_keyed_fixed(
    builder: &CircuitBuilder,
    message: &[Wire],
    len_bytes: usize,
    key: &ByteVec,
) -> [Wire; 8]
Expand description

Computes the keyed BLAKE3 hash of a compile-time fixed-length message.

The keyed mode of blake3_fixed: the 32-byte key replaces the IV as the chaining value every chunk and parent node starts from, and every compression carries KEYED_HASH. This is BLAKE3’s native keying, so the digest matches blake3::keyed_hash.

A key shorter than 32 bytes is zero-padded to 32 — the length of the key vector is not itself hashed, so keys that agree after padding (b"k" and b"k\0") produce the same digest.

§Arguments

  • builder: Circuit builder.
  • message: as in blake3_fixed.
  • len_bytes: as in blake3_fixed.
  • key: the key, 0 to 32 bytes packed little-endian 8 per wire. Its length must be fixed at circuit construction time (a point len_range, as ByteVec::new_const_len builds). Bytes past that length are masked to zero, so a prover cannot steer the digest through them.

§Returns

As in blake3_fixed.