-
Notifications
You must be signed in to change notification settings - Fork 57
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using SHA256 gadget with arbitrary sized input #163
Comments
Hi, https://github.com/Ethsnarks/ethsnarks-hashpreimage is an example of how to prove the preimage to hash. The problem with an arbitrary input size is that the zk-snark circuit is fixed sized, you can hash an arbitrary number of bits (in a way which is compatible with the SHA256 function on Ethereum and everywhere else), as long as you only ever have to prove that you've hashed that specific number of bits. There is a 'gadget' at https://github.com/HarryR/ethsnarks/blob/master/src/gadgets/sha256_many.cpp which will take an arbitrary number of input bytes and hash them in a way which is compatible with a normal SHA256 function (as-long as you pad it to full bytes, rather than e.g. 12 bits) |
I'm new to the zk-snarks world, still trying to figure out how everything works.
I would like to generate a proof of pre-image using SHA256 and an arbitrary sized input.
I was wondering if you could make available some sort of tutorial on how to achieve this, or at least provide some general guidelines on how to use the SHA256 gadget.
Thank you in advance!
The text was updated successfully, but these errors were encountered: