I'm trying to learn more about elliptic curves by playing with the math objects in sage.
I'm getting weird results and wonder what I'm doing wrong...
I'm trying to get the generator of the cyclic subgroup from curve25519.
ec = EllipticCurve(GF(2**255-19), [0,486662,0,1,0]) //should gen the curve
ec.lift_x(9) //should give me the generator of the subgroup?
However I get:
(9 : 43114425171068552920764898935933967039370386198203806730763910166200978582548 : 1)
I should get:
(9 : 14781619447589544791020593568409986887264606134616475288964881837755586237401 : 1)
What am I doing wrong?
The calculation method is given in rfc7748 A.3. Base Points Section for Curve25519:
And outputs
In your case use
output
Your code was only finding one point on the curve with $x=9$ due to the default
Falseparameter. If you setTrueyou will get two points with $x=9$ and according to the standard, you need the choose the minimum that is what you wanted.Also, note that the two $y$'s comes from $P$ and $-P$, so if you add them you will get zero. That is another way to find the other $y$.