Skip to main content

pick_secret_kernel

Function pick_secret_kernel 

Source
pub fn pick_secret_kernel(low: [b8; 64], high: [b8; 64], offset: b6) -> [b8; 18]
Expand description

Pick a chain’s 18 secret bytes from the two-block window.

Inputs: low (the block holding the secret’s first byte), high (the block after it) and offset (even byte offset 0..62 within low). Output: the 18 bytes starting at offset in low ‖ high. Combinational.

Why written as an OR over 32 cases: RHDL turns a dynamic array index into whole-array copies, which is very large. Comparing offset against each of the 32 possible even values with constant indices instead gives a 32-way select per output byte (see the RHDL notes in crate::packer).