operator - method
Implementation
@override
JubJubPoint operator -(BaseRedJubJubPoint rhs) {
switch (rhs) {
case final JubJubNielsPoint point:
final a = (v - u) * point.vPlusU;
final b = (v + u) * point.vMinusU;
final c = t1 * t2 * point.t2d;
final d = (z * point.z).double();
return _JubjubCompletedPoint(
u: b - a,
v: b + a,
z: d - c,
t: d + c,
).toExtended();
case final JubJubAffineNielsPoint point:
final a = (v - u) * point.vPlusU;
final b = (v + u) * point.vMinusU;
final c = t1 * t2 * point.t2d;
final d = z.double();
return _JubjubCompletedPoint(
u: b - a,
v: b + a,
z: d - c,
t: d + c,
).toExtended();
case final JubJubPoint point:
return this - point.toNiels();
case final JubJubAffinePoint point:
return this - point.toNiels();
default:
throw CryptoException.operationNotSupported;
}
}