0

I'm working on elliptic curves with SageMath.
I know :

  1. The equation of the curve E defined by y^2 = x^3 + ... : E = EllipticCurve( GF(K), [m, n] )

  2. the addition of points A and B (A+B) : (x3;y3)

  3. the substraction of points A and B (A-B) : (x4;y4)

Here my goal is to find both A (x1;y1) and B (x2;y2).
I obviously understand how to find (A+B) but don't find how to reverse it and get A and B from the addition of A and B and the substraction too.

I know too I can use these kind of function to generate (A+B) coordinates from A and B coordinates. Here I use the slope of the native elliptic curve given by : -x1 -x2 + (y1-y2)^2/(x1-x2)^2.

    E = EllipticCurve( GF(K), [m, n] )
    # We know A and B coords
    def x3(A, B):
        x1, y1 = A.xy()
        x2, y2 = B.xy()
        return -x1 -x2 + (y1-y2)^2/(x1-x2)^2
    x3(A, B)

I guess there should be something to do with it but I really don't see how to begin.

Any help would be very appreciated, thanks !

EDIT :

Having C=A+B and D=A-B, I made a try with C+D :

C = E(x3, y3)
D = E(x4, y4)
Z = C + D
# Z gives : Z(x5, y5)

I get new coordinates Z(x5, y5) but I could not find both A and B coordinates, which does not fit to what I'd like to do.

Julien
  • 699
  • 3
  • 14
  • 30
  • You have C=A+B and D=A-B. What happens if you compute C+D? – President James K. Polk Apr 24 '23 at 12:42
  • Thank you very much for your answer. I tried to compute C + D and get new coordinates `Z(x5, y5)` . But I could not find both A and B coordinates. – Julien Apr 24 '23 at 14:15
  • Yes, and Z = C + D = A+B+A-B = 2A. So can you find the value of A if you have the value of 2A? How big is K here? – President James K. Polk Apr 24 '23 at 15:31
  • The size of K is : 115792089210356248762697446949407573530086143415290314195533631308867097853951 (this is a secp256r1 elliptic curve) – Julien Apr 24 '23 at 15:50
  • Ok when I try 2A/2 on sagemaths it fails ```(unsupported operand parent(s) for /)```. Should I do something like (A + B) - A to find B coords after ? – Julien Apr 24 '23 at 16:36
  • See [this question and answer](https://math.stackexchange.com/questions/3953558/is-there-an-efficient-formula-for-computing-point-halving-on-elliptic-curves-in) for more discussion. – President James K. Polk Apr 24 '23 at 23:36

0 Answers0