Skip to main content

blake2s_compress

Function blake2s_compress 

Source
pub fn blake2s_compress(
    builder: &CircuitBuilder,
    h: [Wire; 8],
    m: [Wire; 16],
    t_lo: Wire,
    t_hi: Wire,
    last: Wire,
) -> [Wire; 8]
Expand description

BLAKE2s compression function.

§Arguments

  • builder - Circuit builder.
  • h - The 8-word chained state, one 32-bit value per wire.
  • m - The 16-word message block, one 32-bit value per wire.
  • t_lo - Low 32 bits of the byte counter.
  • t_hi - High 32 bits of the byte counter.
  • last - The finalization flag.

All-ones for the final block, zero otherwise.

§Preconditions

The high 32 bits of every input wire must be empty.

Ensuring this is the caller’s responsibility.

Violating it leaves the gadget’s behavior undefined, and unsafe to rely on.

§Returns

The updated 8-word state.

Every wire’s high 32 bits are empty.