iden3 / go-iden3-crypto

Go implementation of some cryptographic primitives (that fit inside the SNARK field) and compatible with circomlib
Apache License 2.0
117 stars 38 forks source link

Update BabyJubJub signature with Poseidon #13

Closed arnaucube closed 4 years ago

arnaucube commented 4 years ago

This PR updates the SignPoseidon & VerifyPoseidon to use directly poseidon.PoseidonHash instead of poseidon.Hash. The poseidon.Hash function is for arbitrary length of inputs, and adds extra computation that is not needed for babyjub.SignPoseidon and babyjub.VerifyPoseidon, as len({8*R.x, 8*R.y, A.x, A.y, msg}) < poseidon.T (where poseidon.T is 6). This allows to avoid unnecessary onchain computation.

This PR comes together with the PR https://github.com/iden3/contracts/pull/27, where the EDDSA BabyJubJub signature verification is done in Solidity.