Skip to content

feat: Expose NewDefaultPermutation in Poseidon2 packages#761

Merged
Tabaie merged 9 commits intomasterfrom
refac/expose-default-permutation
Dec 19, 2025
Merged

feat: Expose NewDefaultPermutation in Poseidon2 packages#761
Tabaie merged 9 commits intomasterfrom
refac/expose-default-permutation

Conversation

@Tabaie
Copy link
Copy Markdown
Contributor

@Tabaie Tabaie commented Oct 21, 2025

For use as a compression function and not a range-extended hasher


Note

Expose NewDefaultPermutation across Poseidon2 packages and switch Merkle–Damgård hashers to use it; add SetBytesCanonical property tests and koalabear Poseidon2 test vectors.

  • Poseidon2:
    • Add NewDefaultPermutation() returning Permutation{GetDefaultParameters()} in poseidon2.go for multiple curves/fields and update NewMerkleDamgardHasher() to use it.
    • Adjust hasher buffer sizing to derive from permutation params; update generator templates accordingly.
  • Tests:
    • Add property-based test: SetBytesCanonical(Bytes()) remains constant in fp/fr element tests across curves and in field generator templates.
    • Add koalabear Poseidon2 test vectors (poseidon2/test-vectors.json) and vectors_test.go validating width, block sizes, and output.

Written by Cursor Bugbot for commit 413eea9. This will update automatically on new commits. Configure here.

@Tabaie Tabaie marked this pull request as ready for review October 22, 2025 14:12
@Tabaie Tabaie requested a review from ThomasPiellard October 22, 2025 14:12
@Tabaie Tabaie requested a review from YaoJGalteland October 27, 2025 21:10
cursor[bot]

This comment was marked as outdated.

@Tabaie Tabaie requested a review from gbotrel December 19, 2025 04:30
@Tabaie Tabaie requested review from ThomasPiellard and removed request for ThomasPiellard December 19, 2025 20:39
@Tabaie Tabaie merged commit f25d8b9 into master Dec 19, 2025
9 checks passed
@Tabaie Tabaie deleted the refac/expose-default-permutation branch December 19, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants