Closed hhhguany closed 1 year ago
Thanks for reporting. I can't reproduce the issue.
$ git diff
diff --git a/ecc/bls12381/g1_test.go b/ecc/bls12381/g1_test.go
index 2f85211..442c7a3 100644
--- a/ecc/bls12381/g1_test.go
+++ b/ecc/bls12381/g1_test.go
@@ -278,3 +278,13 @@ func TestG1Bytes(t *testing.T) {
}
}
}
+
+func TestIssue448(t *testing.T) {
+ a := G1Generator()
+ a.Add(a, a)
+ x := new(G1)
+ x.SetBytes(a.Bytes())
+ if !x.IsEqual(a) {
+ t.Fatal()
+ }
+}
$ go test -run=Issue448 -v
=== RUN TestIssue448
--- PASS: TestIssue448 (0.00s)
PASS
ok github.com/cloudflare/circl/ecc/bls12381 0.099s
Looking at this execution https://go.dev/play/p/QbdDq5E7o1- all the variables match.
Make sure you have the latest version, or compile with the branch main. Let us know, if you are using a different architecture.
Also use the IsEqual
function to compare values. Using operator ==
is not the right way to compare elements.
Thank you, the problem has been resolved. I used the wrong comparison function.
I did a test and when serializing the G1 generator element variable and then deserializing to another variable, the two variables were matched. But once I perform an operation on the G1 element (e.g. Add), the two variables no longer match. Is this a bug?