Skip to main content

blake3_fixed

Function blake3_fixed 

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

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

The BLAKE3 analog of sha256_fixed: the message length is known at circuit construction time, which fixes the chunk/tree shape and eliminates runtime padding logic.

The message is split into 1024-byte chunks (blake3_chunk); each chunk’s chaining value is folded into the digest by BLAKE3’s binary parent tree, two independent parent compressions at a time via blake3_compress_2x. The single ROOT flag lands on the final compression: the lone chunk when the message fits in one chunk, otherwise the tree’s root parent.

§Arguments

  • builder: Circuit builder.
  • message: Input message as 32-bit little-endian words (4 bytes per wire). The high 32 bits of each wire must be zero. Length must equal len_bytes.div_ceil(4).
  • len_bytes: The compile-time-known length of the message in bytes.

§Returns

The BLAKE3 digest as 8 wires, each holding a 32-bit little-endian word in its low 32 bits.