elliptic curve arithmetic without inversion

asked 6 years ago

milksush gravatar image

updated 5 years ago

FrédéricC gravatar image

It seems when you add points on an elliptic curve in sage, it immediately divides by the z coordinate if it is not zero. Since I plan on working in a finite field of a large prime, I would rather it not calculate this inverse, but I'm not sure how to stop it from automatically doing so. How do I get it to leave the z coordinate alone so as to avoid inverting elements of my field?

Preview: (hide)

Comments

In this case it may be simplest to implement the own addition of points on the curve. An own class witn an __add__ method and a __mul__ method would do the job. Which formulas should be implemented for which curve explicitly?

Here are some examples for the usage of __add__ and __mul__:

sage: 12+45
57
sage: 12.__add__(45)
57
sage: E = EllipticCurve( GF(7), [2,3] )
sage: P, Q = E.random_point(), E.random_point()
sage: P, Q
((2 : 1 : 1), (3 : 1 : 1))
sage: P.__add__(Q)
(2 : 6 : 1)
sage: P+Q
(2 : 6 : 1)
sage: P.__mul__(2)
(3 : 6 : 1)
sage: 2*P
(3 : 6 : 1)
sage: P.__mul__(12345)
(6 : 0 : 1)
sage: 12345*P
(6 : 0 : 1)
dan_fulea gravatar imagedan_fulea ( 6 years ago )