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 updates the
SignPoseidon
&VerifyPoseidon
to use directlyposeidon.PoseidonHash
instead ofposeidon.Hash
. Theposeidon.Hash
function is for arbitrary length of inputs, and adds extra computation that is not needed forbabyjub.SignPoseidon
andbabyjub.VerifyPoseidon
, aslen({8*R.x, 8*R.y, A.x, A.y, msg}) < poseidon.T
(whereposeidon.T
is6
). 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.