-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
hi, @mdehoog, thanks for your work, I'll review the code as soon as possible. |
@vmx hi, could you help to review the code? |
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.
This looks like a straight forward refactor, hence sounds good to me. But please note that I'm not really a Go coder.
Thanks. |
@mdehoog plz check the github workflow. Thanks. |
71ec48a
to
117dc8b
Compare
@triplewz thanks for the review! Removed the tests from the workflow 👍 |
(now that triplewz/poseidon#2 is merged)
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 themds
matrix to the constant generation function. I've been able to reproduce the circom's constants exactly when usingfield=1
,sbox=0
, andrp
/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 uprp
to the nearest multiple ofwidth
).Totally understandable if this major refactor is outside the scope of this repo, I'd be happy to maintain a fork if preferred.