Closed pmcampones closed 2 months ago
This is not a failure, one must compare group elements and not curve points. That's why one has to rely on comparing the byte representation (which is unique).
Internally, there are eight curve points (and four for decaf) that can represent the same group element.
Thanks for the quick response. Better safe than sorry.
Hello all,
I think there is some odd behavior in the marshalling and unmarshalling of Elements (points) in the Ristreto curve found in
group.ristreto255
. The structs in question implement theencoding.BinaryMarshaler
andencoding.BinaryUnmarshaler
interfaces. If I marshal a point A and then unmarshal it as point B, the parameters of the point will differ and a deep equality test between them will fail. However, if I then marshal B and compare it with the byte representation of A, they will be equals. This happens whether the point created is a random point, the identity, or anHashToElement
.I noticed that the test
TestRistrettoElGamal
ingroup.ristretto255_test
purposefully compares points by their encoding rather than the points themselves, so I don't know if this discrepancy is accounted for. If it is, all the better, otherwise I think there is some bug in the marshalling/unmarshalling process.