ZK-Garage / plonk

A pure Rust PLONK implementation using arkworks as a backend.
https://discord.gg/XWJdhVf37F
Mozilla Public License 2.0
295 stars 76 forks source link

Poseidon hash #114

Open GhostOfGauss opened 2 years ago

GhostOfGauss commented 2 years ago

This PR adds our first hash function--the optimized Poseidon hash, complete with parameter generation written in Rust. Credit goes to @tsunrise and @BoyuanFeng for writing this.  The contents of this PR is adapted from their implementation here.  (See also this spec) The biggest change is the addition of a HashFunction trait and making hashing stateless.

Some work remains, but I'm opening this draft to start collecting feedback.  What remains is documentation and testing.

Feedback is needed on the overall interface with hash functions.  The HashFunction trait is a starting point for discussion. This topic was opened in Issue #109 and discussion should continue there.  

This will close #104

LukePearson1 commented 2 years ago

Is this PR ready for review @GhostOfGauss? If so, please convert from draft.

GhostOfGauss commented 2 years ago

No, not ready yet

tsunrise commented 2 years ago

@GhostOfGauss The round constant generation code in Manta's plonk prototype repo was incorrect, and I fixed that so it now passes the hardcoded tests. When you have some time can you sync those changes here?