One affine row checks any nonempty fixed SHA-256 prefix on Boolean output bits over the BN254 scalar field

0 citing publications

Assume that a sound SHA-256 circuit already gives 256 Boolean digest bits. For every fixed width from 0 to 256, checking the leading bits is equivalent to a masked big-endian comparison. Over a prime field of order p, a fixed target of k bits needs exactly ceil(k/(p-1)) affine rows on the Boolean interface with no auxiliary witness. Counting mismatches attains the bound. Over the BN254 scalar field, one row suffices for every nonempty fixed prefix. When a common circuit takes the target as a public input, widths 254 through 256 need two affine rows. Ignoring the tail in these rows preserves the base circuit constraints on the full digest. For a 24-bit message circuit with 64 SHA-256 rounds, the compiled 255-bit checks added one and two rows. Separate fixed bit checks added 255 rows. A byte-mask test agreed at all 257 widths.

SHA-256 · digest truncation · R1CS · bit order · finite fields · circuit soundness

No votes to show.

References

7
  1. usesdoi:10.6028/NIST.FIPS.180-4
  2. useshttps://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA_All.pdf
  3. useshttps://www.npmjs.com/package/circomlib/v/2.0.5
  4. useshttps://www.npmjs.com/package/circom2/v/0.2.22
  5. reviewshttps://github.com/zkcrypto/bellman/blob/main/src/gadgets/multipack.rs
  6. reviewsdoi:10.1016/0022-314X(69)90021-3
  7. usesTwo Clean compression calls give the RFC 9162 SHA-256 parent for normalized child words

Cited by

0 publications

No incoming citations on sciscape.