Type Definition o1vm::keccak::column::KeccakWitness

source ·
pub type KeccakWitness<T> = Witness<N_ZKVM_KECCAK_REL_COLS, T>;
Expand description

The witness columns used by the Keccak circuit. The Keccak circuit is split into two main modes: Sponge and Round. The columns are shared between the Sponge and Round steps. The hash and step indices are shared between both modes. The row is split into the following entries:

  • hash_index: Which hash this is inside the circuit

  • block_index: Which block this is inside the hash

  • step_index: Which step this is inside the hash

  • curr: Contains 1965 witnesses used in the current step including Input

  • next: Contains the 100 Output witnesses

  • round_flags: contain 5 elements with information about the current round step

  • pad_flags: PadLength, TwoToPad, PadBytesFlags, PadSuffix

  • mode_flags: what kind of mode is running: round, root, absorb, pad, rootpad, squeeze. Only 1 of them can be active.

    Keccak Witness Columns: KeccakWitness.cols


| 0 | 1 | 2 | 3..=1967 | 1968..=2067 | 2068..=2071 |

0 -> hash_index 1 -> block_index 2 -> step_index 3..=1967 -> curr 3 1967 <––––––––––––––––if_round<–––––––––––––––––> <———––if_sponge–––––––> 3 802 -> SPONGE:   | -> ROUND: -> 3..=102: Input == SpongeOldState | -> 3..=102: Input == ThetaStateA -> 103..=202: SpongeNewState | -> 103..=182: ThetaShiftsC : 170..=202 -> SpongeZeros | -> 183..=202: ThetaDenseC -> 203..=402: SpongeBytes | -> 203..=207: ThetaQuotientC -> 403..=802: SpongeShifts | -> 208..=227: ThetaRemainderC | -> 228..=247: ThetaDenseRotC | -> 248..=267: ThetaExpandRotC | -> 268..=667: PiRhoShiftsE | -> 668..=767: PiRhoDenseE | -> 768..=867: PiRhoQuotientE | -> 868..=967: PiRhoRemainderE | -> 968..=1067: PiRhoDenseRotE | -> 1068..=1167: PiRhoExpandRotE | -> 1168..=1567: ChiShiftsB | -> 1568..=1967: ChiShiftsSum 1968..=2067 -> next -> 1968..=2067: Output (if Round, then IotaStateG, if Sponge then SpongeXorState)

2068..=2072 -> round_flags -> 2068: RoundNumber -> 2069..=2072: RoundConstants

2073..=2078 -> selectors

803..=945 -> pad_flags -> 803: PadLength -> 804: TwoToPad -> 805..=809: PadSuffix -> 810..=945: PadBytesFlags

Trait Implementations§

source§

impl<T: Clone> Index<ColumnAlias> for KeccakWitness<T>

IMPLEMENTATIONS FOR COLUMN ALIAS

source§

fn index(&self, index: ColumnAlias) -> &Self::Output

Map the column alias to the actual column index. Note that the column index depends on the step kind (Sponge or Round). For instance, the column 800 represents PadLength in the Sponge step, while it is used by intermediary values when executing the Round step.

§

type Output = T

The returned type after indexing.
source§

impl<T: Clone> Index<Steps> for KeccakWitness<T>

source§

fn index(&self, index: Steps) -> &Self::Output

Map the column alias to the actual column index. Note that the column index depends on the step kind (Sponge or Round). For instance, the column 800 represents PadLength in the Sponge step, while it is used by intermediary values when executing the Round step. The selector columns are located at the end of the witness relation columns.

§

type Output = T

The returned type after indexing.
source§

impl<T: Clone> IndexMut<ColumnAlias> for KeccakWitness<T>

source§

fn index_mut(&mut self, index: ColumnAlias) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<T: Clone> IndexMut<Steps> for KeccakWitness<T>

source§

fn index_mut(&mut self, index: Steps) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more