RustCrypto / elliptic-curves

Collection of pure Rust elliptic curve implementations: NIST P-224, P-256, P-384, P-521, secp256k1, SM2
661 stars 182 forks source link

Poseidon Support for k256 Hash To Curve #1049

Open shreyas-londhe opened 4 months ago

shreyas-londhe commented 4 months ago

Hi, we have a requirement to use the Poseidon hash function instead of the sha256 hash function in the hash2curve for the curve k256. I'm more than happy to implement it and make a PR with a little bit of help. Please let me know if this would be a good addition and where I can start from.

tarcieri commented 4 months ago

We don't currently have an implementation of Poseidon, although there was some discussion of adding one (and/or Poseidon2) here: https://github.com/RustCrypto/hashes/issues/1

k256 is designed so you can implement algorithms like Poseidon in downstream crates. It should be possible to implement it in such a way that it's generic over elliptic curves as well. As such, it probably shouldn't go in k256 itself.