-
Notifications
You must be signed in to change notification settings - Fork 198
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
feat: Poseidon2 Hash Instantiation for BLS12-377 #623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed that we didn't have the diagonal matrices if T != 2,3
, so I explicitly call panic for now to ensure this mode is not used. Previously we essentially multiplied by uninitialized (zero) matrix which is probably insecure.
I also refactored a bit so that we can better refer to the parameters and round constants from gnark side. I also made the seed fully deterministic as this is what the reference implementation did and imo leaves less room for making errors.
Finally, renamed some of the arguments/field names to better describe what they are (as previously we would have to check the actual implementation instead of the package documentation).
I also separated the GKR gates into a separate package so that we would only need to load it when needed. I also recommend using the registry-based approach as currently the gkr.Gates
access is not synchronized which may lead to inconsistent state.
I see that you have already started another PR #628 which assumes this PR. Feel free to revert the commits but I think it could be useful for more generic usage.
Description
This PR provides a generic Merkle Damgard construction, an instantiation of Poseidon2 as a hash for BLS12-377, and GKR gates for the same curve.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran or implemented to verify your changes. Provide instructions so we can reproduce.
How has this been benchmarked?
Please describe the benchmarks that you ran to verify your changes.
Checklist:
golangci-lint
does not output errors locally