Skip to content

Secret Value and Pre-Calculating Hash in gnark's "Hash of Secret" Example #1421

Answered by ivokub
artyapple asked this question in Q&A

You must be logged in to vote

SNARK circuits in general are defined over a finite field, meaning that all operations are done modulo some prime number (or a power of prime number). In gnark case, as we currently by default support only pairing based backends (Groth16 and PLONK), then these finite fields are defined by the elliptic curves which we support. See the list of the elliptic curves here and the implementations here (see the fr/ subpackages which stand for scalar field).

This also means, that by default the witness what can be provided also needs to be a finite field element. gnark tries to cast inputs to the field as much as possible (i.e. uint64 fits into the field -> cast to field element; string representa…

Replies: 1 comment 2 replies

You must be logged in to vote
2 replies
@lock9

@ivokub

Answer selected by artyapple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants