oblivious icon indicating copy to clipboard operation
oblivious copied to clipboard

Document the purpose of `point.canonical()`

Open wyatt-howe opened this issue 9 months ago • 0 comments

Document the purpose of point.canonical(), performance benefit, equality of the bytes returned by point.to_bytes().

We just need to be clear that the bytes spit out (when you type a point variable into the interpreter, or print .to_bytes()) for p1 and p2 where p1 == p2 are not always the same.

Then, we can have .to_bytes(canonicalize=True) be the default and clarify that .to_bytes(canonicalize=False) is faster if you aren't doing byte-to-byte comparisons or other derivations directly from the bytes spit out.

Users of this library need to know that assert (p1.to_bytes() == p2.to_bytes()) == (p1 == p2) will sometimes fail, depending on how the points were computed (due to algorithms for computing point operations using optimizations such as using Jacobi coordinates x,y,z to represent points vs affine coordinates x,y and so on).

wyatt-howe avatar May 07 '24 19:05 wyatt-howe