Skip to main content

blake2s_compress_2x

Function blake2s_compress_2x 

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

BLAKE2s compression function running two independent compressions in parallel.

Each 64-bit input wire packs two 32-bit lanes.

Bits 0 through 31 hold lane 0’s word.

Bits 32 through 63 hold lane 1’s word.

Every gate the mixing core uses already acts independently on each half.

So the ten mixing rounds compute both compressions for the gate cost of a single one.

§Arguments

Every wire packs two lanes, as described above.

  • h - The 8-word chained state.
  • m - The 16-word message block.
  • t_lo - Low 32 bits of the byte counter.
  • t_hi - High 32 bits of the byte counter.
  • last - The finalization flag.

§Returns

The updated 8-word state.

Each wire packs both lanes’ results.

§Chips

This gadget can be registered as a chip.

Doing so turns every paired compression under it into a chip call, including the ones a sequential pairing and the fixed-length hasher reach.