From 5766879636cd88894976fe2db9a10c2684dda193 Mon Sep 17 00:00:00 2001 From: Kevin Jue Date: Mon, 18 Dec 2023 17:09:06 -0800 Subject: [PATCH] fix for V-SCT-VUL-00 and V-SCT-VUL-010 --- poseidon/bn254.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poseidon/bn254.go b/poseidon/bn254.go index 77ac7ce..4291efd 100644 --- a/poseidon/bn254.go +++ b/poseidon/bn254.go @@ -76,8 +76,10 @@ func (c *BN254Chip) HashOrNoop(input []gl.Variable) BN254HashOut { returnVal := frontend.Variable(0) alpha := new(big.Int).SetInt64(1 << 32) + alpha = new(big.Int).Mul(alpha, alpha) for i, inputElement := range input { - returnVal = c.api.MulAcc(returnVal, inputElement, alpha.Exp(alpha, big.NewInt(int64(i)), nil)) + mulFactor := new(big.Int).Exp(alpha, big.NewInt(int64(i)), nil) + returnVal = c.api.MulAcc(returnVal, inputElement, mulFactor) } return BN254HashOut(returnVal)