Prove SHA-256 hashes in zero knowledge: all 64 rounds of the FIPS 180-4 compression function per block, with padding and block chaining in your program.
The SHA-256 chiplet proves the 64 rounds of the SHA-256 compression function, FIPS 180-4 §6.2.2, on one 512-bit block,
from an input state to an output state. The RSA chiplet hashes its message through it.
The host program requests (state_in, block) → state_out once per block over the sha256_rounds bus and applies the
feed-forward addition h_out = h_in + state_out itself, through CpuSha256Block. The chiplet constrains the rounds
over bit-expanded 32-bit columns, with one committed carry word per 32-bit addition, Ch and Maj committed, and
composition degree 2.
Rounds per row: 1, 2, 4, 8 or 16, each a divisor of 64; a block takes 64 / rounds_per_row rows.
Both belong to the host program. The README's Usage section pads the message in host code with pad_message,
pins the first block's h_in to the initial hash value with boundary constraints, and constrains every later block's
h_in to equal the previous block's h_out. The digest is the last block's h_out, which the program publishes.
hekate/examples/sha256.rs scales SHA-256 with the chiplet mounted inline in the CPU trace. From a hekate checkout:
bash
HEKATE_NUM_VARS=21HEKATE_ROUNDS_PER_ROW=4just example sha256 public
HEKATE_NUM_VARS sets the trace to 2^n rows. public builds the variable-time table-math prover that the README's
measurements use. Without it the recipe builds the constant-time prover, the one to use when the witness is private.
The program below turns the example into a full SHA-256 statement: the prover knows a 56-byte message whose SHA-256
digest is the published value. It hashes the two-block example message of FIPS 180-2, Appendix B.2, at two rounds per
row, in three files:
src/program.rs mounts the chiplet, pins the first block's input to the initial hash value, chains the second block
to the first, pins every padding word of a 56-byte message and publishes the digest. It refuses a length that is not
a multiple of 4 bytes, because a word that mixes message bytes and padding cannot be pinned whole.
src/trace.rs runs the two compressions on the host and fills the table, with the chiplet's columns appended.
src/main.rs proves and verifies.
Start from the crates in Installation and add hekate-sha2 and rand.
Zero-knowledge proofs, measured on Apple M3 Max, 16 cores. Build: --release, std parallel blake3 table-math public. Best of three on an otherwise idle machine. The Benchmarks page has the base-protocol figures and the command for each run.
hekate-sha2 is AGPL-3.0-only. Commercial licenses are available from Oumuamua Labs at
info@oumuamua.dev. The README's Usage section builds the SHA-256 of one message
with one compression per host row, and the API reference is on docs.rs.