-
Notifications
You must be signed in to change notification settings - Fork 88
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(eddsa-poseidon): adds Blake2s hashing for eddsa and conditional imports #329
feat(eddsa-poseidon): adds Blake2s hashing for eddsa and conditional imports #329
Conversation
…imports Currently EdDSA Poseidon hashes using Blake 1, which is now outdated. This commit swaps the default hashing algorithm for Blake2, whilst also introducing conditional imports so the user can specify the underlying hashing algorithm if required. BREAKING CHANGE: n
I don't think I have the time or expertise to review this in detail, but here are a few design discussion points to consider from the point of view of 0xPARC's projects (Zupass and PODs) making use of this library, which might be a reasonable stand-in for
For Zupass in particular, we have existing tickets and PODs signed using the blake-1 variant so we're unlikely to switch anytime soon, and would have to introduce some new version/config fields in our formats in order to do so. I'd expect SemaphoreV4 to be in a similar situation where they care very much about compatibility. I'd be interested to hear the advantages of blake-2b so as to think carefully about when an upgrade might be warranted. Are there known vulnerabilities in blake-1? Is blake-2b stronger, faster, or superior in some other way? |
Thanks for the comment @artwyman. As far as I understand it, Blake2 is optimised to be faster and more efficient, whilst reliably offering a similar level of security. Thus if changing it could cause a headache down the line, I agree that it might be better to keep it as an option rather than changing the default, and this can always be a decision that is easily taken later. In terms of bundle size, I have structured the code to only return the compiled version of the chosen algorithm, so that should be working as intended. |
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.
Hey @hannahredler, thanks for this PR!
I added some comments 👍🏽
…sh function interface
…the blakejs library BREAKING CHANGE: n
… the export files re 152
@cedoor comments addressed - ready for re-review 👍 |
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.
LGTM, just two comments before merging!
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2024 ZK-KIT Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Description
Current implementation of the EdDSA Poseidon uses the Blake-1 hashing algorithm. This PR implements Blake2b algorithm and conditional imports such that the user can choose to use a different hashing algorithm if required.
Related Issue(s)
Partially Closes #152
Adds the first optional hashing algorithm
Other information
The implementation of Blake2b is based on this one, migrated to Typescript and changed to a class structure to mirror the Blake1 implementation. The test cases were lifted directly from the repo to ensure consistent output.
Checklist
yarn style
without getting any errors