Usually one explains how the R1CS/QAPs and SNARKs work using examples of circuits with multiplication and addition nodes, and constructing polynomials from that is relatively straightforward. SHA-2 hashing uses complicated bit-wise arithmetic applied to itself multiple times, not simple multiplications and additions. How does one even construct a circuit to prove that a string hashes to a hash? Is there anywhere online I could read about this in an approachable form?

  • $\begingroup$ Would you read source code of SHA libsnark gadget? $\endgroup$ Aug 23 at 14:15
  • $\begingroup$ @VadymFedyukovych I was hoping for something like an overview and explanation of a general principle $\endgroup$
    – DeLorean88
    Aug 23 at 18:43
  • $\begingroup$ What if someone will ask you about general principles of C++ or Java programming? R1CS is the language, there are known-good examples in the gadgets library ranging from elementary to SHA (which is large). Would you start from the idea of bit representation of the input string-to-hash, considering each bit as an R1CS variable? $\endgroup$ Aug 24 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.