You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have written some tests to better understand the library. I came across a problem. In my opinion according to the laws of exponentiation ( (a^b)^c = a^(b*c) ), all tests should return true since a^(b * inv(b)) = a. But the second and fourth don't.
Is there a fault in my reasoning or is this a bug?
key, err := bls.RandFQ12(rand.Reader)
if err != nil {
fmt.Println(err)
return
}
k, err := bls.RandFQ(rand.Reader)
if err != nil {
fmt.Println(err)
return
}
kInv, b := k.Inverse()
if !b {
fmt.Println("no inverse")
return
}
r := k.Copy()
r.MulAssign(kInv)
tmp := key.Exp(k.ToRepr()).Exp(kInv.ToRepr())
fmt.Println("Test 1: ", r.Equals(bls.FQOne))
fmt.Println("Test 2: ", key.Equals(tmp))
g := bls.G1AffineOne.Mul(k.ToRepr())
h := bls.G2AffineOne.Mul(kInv.ToRepr())
p := bls.Pairing(g, h)
palt := bls.Pairing(bls.G1AffineOne.ToProjective(), bls.G2AffineOne.ToProjective())
fmt.Println("Test 3: ", r.Equals(bls.FQOne))
fmt.Println("Test 4: ", p.Equals(palt))
fmt.Println("Test 5: ", p.Equals(palt.Exp(k.ToRepr()).Exp(kInv.ToRepr())))
The text was updated successfully, but these errors were encountered:
I have written some tests to better understand the library. I came across a problem. In my opinion according to the laws of exponentiation ( (a^b)^c = a^(b*c) ), all tests should return true since a^(b * inv(b)) = a. But the second and fourth don't.
Is there a fault in my reasoning or is this a bug?
The text was updated successfully, but these errors were encountered: