Extend Poseidon to 16 inputs (#39)

This commit is contained in:
Oleksandr Brezhniev
2021-10-06 16:09:20 +03:00
committed by GitHub
parent ef9f86210a
commit c544ba0f3c
2 changed files with 27 additions and 10 deletions

View File

@@ -56,8 +56,8 @@ func mix(state []*ff.Element, t int, m [][]*ff.Element) []*ff.Element {
// Hash computes the Poseidon hash for the given inputs
func Hash(inpBI []*big.Int) (*big.Int, error) {
t := len(inpBI) + 1
if len(inpBI) == 0 || len(inpBI) >= len(NROUNDSP)-1 {
return nil, fmt.Errorf("invalid inputs length %d, max %d", len(inpBI), len(NROUNDSP)-2) //nolint:gomnd,lll
if len(inpBI) == 0 || len(inpBI) > len(NROUNDSP) {
return nil, fmt.Errorf("invalid inputs length %d, max %d", len(inpBI), len(NROUNDSP)) //nolint:gomnd,lll
}
inp := utils.BigIntArrayToElementArray(inpBI[:])