don't declare so many vars

This commit is contained in:
filifa 2025-08-21 19:56:56 -04:00
parent 8333be5d2d
commit 3c1ade74aa
1 changed files with 5 additions and 6 deletions

View File

@ -161,12 +161,11 @@ func PrimitiveRootFast(modulus *big.Int, tpf map[string]*big.Int) (*big.Int, err
isPrimitive := true isPrimitive := true
for p := range tpf { for p := range tpf {
e := new(big.Int) // we already know factors are valid from computing phi
f, _ := new(big.Int).SetString(p, 10) k, _ := new(big.Int).SetString(p, 10)
k := new(big.Int).Div(phi, f) k.Div(phi, k)
e.Exp(g, k, modulus) k.Exp(g, k, modulus)
if k.Cmp(big.NewInt(1)) == 0 {
if e.Cmp(big.NewInt(1)) == 0 {
isPrimitive = false isPrimitive = false
break break
} }