# Check if two ed25519 points are equivalent

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];
};

• 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. Apr 24 '19 at 11:07
• This is not a programming question. This is a question about the representation of the point equivalence relation in a particular coordinate system. Apr 24 '19 at 14:18

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.

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.
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.