Closed blynn closed 3 years ago
Not sure this is a problem. That 1A01111...AAB is the modulus p. The library uses lazy reduction, and field elements need to be fully reduced wrt the modulus before being compared. After reduction the 1A01111...AAB becomes 0 mod p. The fact that it happens in such a simple case is I suspect an artifact that arises from Montgomery reduction, where here we lazily do not perform the "final subtraction".
Thanks! So it's not a normalization problem at all and I should call reduce()
before serialization if I want the element in a canonical form (just as equals()
does internally).
For the applications I have in mind, I'd prefer if tobytes()
and tostring()
always called reduce()
implicitly, but I suppose there may be some applications where the existing behaviour is better.
Computing 1*1 in FP12 results in something that tests equal to 1, but is incorrectly normalized.
Output: