Skip to content
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

Add support for custom fields + generation parameters #2

Merged
merged 15 commits into from
Mar 1, 2024

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Feb 24, 2024

Firstly thank you for your poseidon implementation, I've found it very helpful personally.

This PR adds support for passing in custom field elements from the gnark-crypto library as a generic argument. This means any curve can be used, not just BLS12-381.

Secondly, it adds the ability to pass in custom values for rp, rf, field, sbox, and the mds matrix to the constant generation function. I've been able to reproduce the circom's constants exactly when using field=1, sbox=0, and rp / rf / mds values calculated by https://extgit.iaik.tugraz.at/krypto/hadeshash/-/blob/master/code/generate_params_poseidon.sage (with a minor modification to round up rp to the nearest multiple of width).

Totally understandable if this major refactor is outside the scope of this repo, I'd be happy to maintain a fork if preferred.

@triplewz
Copy link
Owner

hi, @mdehoog, thanks for your work, I'll review the code as soon as possible.

@triplewz
Copy link
Owner

@vmx hi, could you help to review the code?

Copy link
Contributor

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a straight forward refactor, hence sounds good to me. But please note that I'm not really a Go coder.

@triplewz
Copy link
Owner

This looks like a straight forward refactor, hence sounds good to me. But please note that I'm not really a Go coder.

Thanks.

@triplewz
Copy link
Owner

@mdehoog plz check the github workflow. Thanks.

@mdehoog mdehoog force-pushed the gnark-crypto-elements branch from 71ec48a to 117dc8b Compare February 29, 2024 17:50
@mdehoog
Copy link
Contributor Author

mdehoog commented Feb 29, 2024

@triplewz thanks for the review! Removed the tests from the workflow 👍

@triplewz triplewz merged commit 7d33728 into triplewz:master Mar 1, 2024
1 check passed
mdehoog added a commit to mdehoog/poseidon that referenced this pull request Mar 1, 2024
@mdehoog mdehoog deleted the gnark-crypto-elements branch March 1, 2024 02:01
@triplewz triplewz linked an issue Oct 29, 2024 that may be closed by this pull request
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.

New release with gnark-crypto support
3 participants