openvm_keccak256_circuit/constants.rs
1// ==== VM-specific constants ====
2/// Number of cells to read/write in a single memory access
3pub const KECCAK_WORD_SIZE: usize = 4;
4/// The number of memory blocks needed to access the entire keccakf state.
5pub const KECCAK_WIDTH_WORDS: usize = KECCAK_WIDTH_BYTES / KECCAK_WORD_SIZE;
6
7// ==== Do not change these constants! ====
8/// Total number of sponge bytes: number of rate bytes + number of capacity
9/// bytes.
10pub const KECCAK_WIDTH_BYTES: usize = 200;
11/// Total number of 16-bit limbs in the sponge.
12pub const KECCAK_WIDTH_U16S: usize = KECCAK_WIDTH_BYTES / 2;
13/// Total number of 64-bit limbs in the sponge.
14pub const KECCAK_WIDTH_U64S: usize = KECCAK_WIDTH_BYTES / 8;
15/// Number of rate bytes.
16pub const KECCAK_RATE_BYTES: usize = 136;
17/// Number of 16-bit rate limbs.
18pub const KECCAK_RATE_U16S: usize = KECCAK_RATE_BYTES / 2;
19/// Number of absorb rounds, equal to rate in u64s.
20pub const NUM_ABSORB_ROUNDS: usize = KECCAK_RATE_BYTES / 8;
21/// Number of capacity bytes.
22pub const KECCAK_CAPACITY_BYTES: usize = 64;
23/// Number of 16-bit capacity limbs.
24pub const KECCAK_CAPACITY_U16S: usize = KECCAK_CAPACITY_BYTES / 2;
25/// Number of output digest bytes used during the squeezing phase.
26pub const KECCAK_DIGEST_BYTES: usize = 32;
27/// Number of 64-bit digest limbs.
28pub const KECCAK_DIGEST_U64S: usize = KECCAK_DIGEST_BYTES / 8;