How to check if two points are equivalent given their projective coordinates (XYTZ)?

For example if I do unproject() of a point to pass from XYTZ to XY coordinates and then I come back to XYTZ coordinates, the new XYTZ coordinates are different respect to the original ones.

How can I be sure that the two points are equivalent in C if they are represented in the following way:

struct ed25519_pt {
    uint8_t  x[32];
    uint8_t  y[32];
    uint8_t  t[32];
    uint8_t  z[32];
  • 2
    $\begingroup$ I'll leave the question open for now as there is a language agnostic answer. If you require C code to perform the calculations then you should definitely ask on StackOverflow. $\endgroup$
    – Maarten Bodewes
    Apr 24 '19 at 11:07
  • $\begingroup$ This is not a programming question. This is a question about the representation of the point equivalence relation in a particular coordinate system. $\endgroup$ Apr 24 '19 at 14:18

Short answer:

The affine coordinates are (X/Z, Y/Z).

So, check that Y1*(1/Z1) ≡ Y2*(1/Z2) and that the signs of X1*Z1 and X2*Z2 are the same.

Z being 0 represents the point at infinity.

Slightly longer answer:

Think about (X, Y, Z) as a fraction representation of (X', Y') with X' = X/Z and Y' = Y/Z. T is just X*Y and is not relevant here.

What you mean by "unproject" is going from a fraction to a scalar. Once this is done, you get something equivalent, but the denominator is lost.

You can go back to a fraction representation by setting the denominator to 1. This is what happens when you go from an affine representation to a projective or extended one.

(X, Y, Z) may look different after a round trip, but this is the same set of affine coordinates, just with a different denominator Z.

  • $\begingroup$ I presume Z is the denominator? Please do explain that in the answer.... $\endgroup$
    – Maarten Bodewes
    Apr 24 '19 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.