mirror of
https://github.com/arnaucube/go-iden3-crypto.git
synced 2026-02-08 03:56:42 +01:00
Fix Poseidon Hash check for inputs being in Finite Field (#42)
This commit is contained in:
committed by
GitHub
parent
64e757cc4a
commit
f597e20569
@@ -1,6 +1,7 @@
|
||||
package poseidon
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
@@ -59,6 +60,9 @@ func Hash(inpBI []*big.Int) (*big.Int, error) {
|
||||
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
|
||||
}
|
||||
if !utils.CheckBigIntArrayInField(inpBI[:]) {
|
||||
return nil, errors.New("inputs values not inside Finite Field")
|
||||
}
|
||||
inp := utils.BigIntArrayToElementArray(inpBI[:])
|
||||
|
||||
nRoundsF := NROUNDSF
|
||||
|
||||
Reference in New Issue
Block a user