Skip to content

Commit 9fc7cee

Browse files
committed
spec/keccak: define round constant lookup
1 parent 7341d6d commit 9fc7cee

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

spec/keccak.typ

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,15 @@ Lastly, the round chip contributes the following interactions to the lookup:
9494
== Optimizations
9595
- step $rho$ does not need to be applied to `state[0][0]`; its has a zero-shift. This saves 16 columns and 4 `HWSL` interactions.
9696
- $#`rc[2]` = #`rc[4]` = #`rc[5]` = #`rc[6]` = 0$. As such, those elements need not be stored in `rc`, and need not be XORed into the state in the $iota$-step. This saves 8 columns and 4 `XOR_BYTE` interactions.
97+
98+
= Round constant lookup
99+
#let rc_chip = load_chip("src/keccak_rc.toml", config)
100+
#let keccak_rc = raw(rc_chip.name)
101+
102+
== Columns
103+
#let nr_variables = total_nr_variables(rc_chip)
104+
#let nr_columns = total_nr_instantiated_columns(rc_chip, config)
105+
106+
We provide the round constants through a short precomputed lookup table: #keccak_rc.
107+
#render_chip_variable_table(rc_chip, config)
108+
#render_constraint_table(rc_chip, config)

spec/src/keccak_rc.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name = "KECCAK_RC"
2+
3+
[[variables.input]]
4+
name = "round"
5+
type = "BaseField"
6+
desc = ""
7+
precomputed = true
8+
9+
[[variables.input]]
10+
name = "RC"
11+
type = ["Byte", 8]
12+
desc = "round constants for the given `round`"
13+
precomputed = true
14+
15+
[[variables.multiplicity]]
16+
name = "μ"
17+
type = "BaseField"
18+
desc = ""
19+
20+
[[constraint_groups]]
21+
name = "contributions"
22+
23+
[[constraints.contributions]]
24+
kind = "interaction"
25+
tag = "KECCAK_RC"
26+
input = ["round"]
27+
output = "RC"
28+
multiplicity = ["-", "μ"]

0 commit comments

Comments
 (0)