feat(stdlib): Implement Poseidon hash#768
Merged
jfecher merged 32 commits intonoir-lang:masterfrom Apr 3, 2023
Merged
Conversation
guipublic
requested changes
Feb 8, 2023
Contributor
guipublic
left a comment
There was a problem hiding this comment.
Thank you for this submission, I have added my comments below.
jfecher
reviewed
Feb 8, 2023
Contributor
jfecher
left a comment
There was a problem hiding this comment.
Some quick style suggestions
guipublic
requested changes
Feb 8, 2023
Contributor
guipublic
left a comment
There was a problem hiding this comment.
Looks good, I just have a few comments.
Contributor
Author
|
Thanks for the comments. I've incorporated your changes. A couple of things worth noting:
|
guipublic
previously approved these changes
Feb 9, 2023
Contributor
guipublic
left a comment
There was a problem hiding this comment.
It fine for me.
The verification seems to be failing, which could be due to an existing issue.
jfecher
approved these changes
Apr 3, 2023
Contributor
|
@ax0 Thank you for the PR and for your patience in getting it merged. It's very much appreciated :) |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue(s)
Resolves #387
Description
This PR implements the Poseidon hash function. It is exposed in the form of a permutation function (
hash::poseidon::permute) for fixed-length and an absorption function (hash::poseidon::absorb) for variable-length inputs. Both functions take the usual parameters as inputs in addition to the input state. Instantiations are provided for fixed length inputs of length 2 to 17 ashash::poseidon::bn254::perm::x5_2, ...,hash::poseidon::bn254::perm::x5_17for the field size currently used, which are in agreement with those used by Circom. A sponge functionhash::poseidon::bn254::spongeis provided for variable-length inputs in accordance with a suggested application in §3 of the paper .Summary of changes
Addition of Poseidon hash under
noir_stdlib/src/hashwith corresponding declaration inhash.nrDependency additions / changes
Test additions / changes
Two test cases under
nargo/tests/test_data, separated into permutation tests and a sponge test. The former test agrees with Circom's tests and the latter may be verified in Arkworks using appropriate incantations ofabsorbandsqueeze_field_elements. These cases are also listed in theconfig.toml.Checklist
cargo fmtwith default settings.Additional context