Equality Testing

Testing equality of two Ristretto points means testing whether they are equal in the quotient group, i.e., whether they lie in the same coset of E[4]\mathcal E[4] (for the cofactor-88 case) or E[2]\mathcal E[2] (for the cofactor-44 case).

Equality testing of points on the Edwards curve requires comparing to affine coordinates, which requires an expensive inversion. However, testing whether two points lie in the same coset can be done in projective coordinates, making it actually easier than equality testing in the original non-quotient group.

The Decaf paper proves that in the cofactor-44 case, to test equality of P1=(X1:Y1:Z1:T1)P_1 = (X_1:Y_1:Z_1:T_1) and P2=(X2:Y2:Z2:T2)P_2 = (X_2:Y_2:Z_2:T_2) it's sufficient to test whether X1Y2=Y1X2. X_1 Y_2 = Y_1 X_2.

In the cofactor-88 case, we need to test equality not modulo E[2]\mathcal E[2] but modulo E[4]\mathcal E[4]. This means we need to check whether either P1P2(modE[2]) P_1 \equiv P_2 \pmod {\mathcal E[2]} or P1+Q4P2(modE[2]) P_1 + Q_4 \equiv P_2 \pmod {\mathcal E[2]} , where Q4Q_4 is a 44-torsion point.

Write P1+Q4=(X1:Y1:Z1:T1)P_1 + Q_4 = (X_1' : Y_1' : Z_1' : T_1'). In affine coordinates, P+Q4=(y/a,xa)P + Q_4 = (y/\sqrt a, -x\sqrt a), so that X1=Y1/aX_1' = Y_1 / \sqrt a, Y1=X1aY_1' = -X_1 \sqrt a. The equation X1Y2=Y1X2 X_1' Y_2 = Y_1' X_2 then becomes Y1Y2/a=aX1X2 Y_1 Y_2 / \sqrt a = - \sqrt a X_1 X_2 or equivalently Y1Y2=aX1X2. Y_1 Y_2 = - a X_1 X_2.

So, to check equality modulo E[4]\mathcal E[4], it's sufficient to check whether X1Y2=Y1X2orY1Y2=aX1X2. X_1 Y_2 = Y_1 X_2 \quad \mathrm{or} \quad Y_1 Y_2 = -a X_1 X_2.