mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 09:01:32 +01:00
removed Exp in goldilocks/base.go per V-SCT-VUL-016
This commit is contained in:
@@ -269,28 +269,6 @@ func InverseHint(_ *big.Int, inputs []*big.Int, results []*big.Int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Computes a field element raised to some power.
|
|
||||||
func (p *Chip) Exp(x Variable, k *big.Int) Variable {
|
|
||||||
if k.IsUint64() && k.Uint64() == 0 {
|
|
||||||
return One()
|
|
||||||
}
|
|
||||||
|
|
||||||
e := k
|
|
||||||
if k.Sign() == -1 {
|
|
||||||
panic("Unsupported negative exponent. Need to implement inversion.")
|
|
||||||
}
|
|
||||||
|
|
||||||
z := x
|
|
||||||
for i := e.BitLen() - 2; i >= 0; i-- {
|
|
||||||
z = p.Mul(z, z)
|
|
||||||
if e.Bit(i) == 1 {
|
|
||||||
z = p.Mul(z, x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return z
|
|
||||||
}
|
|
||||||
|
|
||||||
// The hint used to split a GoldilocksVariable into 2 32 bit limbs.
|
// The hint used to split a GoldilocksVariable into 2 32 bit limbs.
|
||||||
func SplitLimbsHint(_ *big.Int, inputs []*big.Int, results []*big.Int) error {
|
func SplitLimbsHint(_ *big.Int, inputs []*big.Int, results []*big.Int) error {
|
||||||
if len(inputs) != 1 {
|
if len(inputs) != 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user