operator - method

CompletedGroupElement operator -(
  1. Object other
)

Implementation

CompletedGroupElement operator -(Object /* CachablePoint */ other) {
  if (other is CachablePoint) {
    final q = other.toCached;

    final r = CompletedGroupElement();
    r.X = Y + X;
    r.Y = Y - X;
    r.Z = r.X * q.yMinusX;
    r.Y = r.Y * q.yPlusX;
    r.T = q.t2d * T;

    FieldElement t0 = Z * q.z;
    t0 = t0 + t0;
    r.X = r.Z - r.Y;
    r.Y = r.Z + r.Y;
    r.Z = t0 - r.T;
    r.T = t0 + r.T;
    return r;
  } else if (other is PrecomputablePoint) {
    PreComputedGroupElement q = other.toPrecomputed;

    final r = CompletedGroupElement();
    r.X = Y + X;
    r.Y = Y - X;
    r.Z = r.X * q.yMinusX;
    r.Y = r.Y * q.yPlusX;
    r.T = q.xy2d * T;

    FieldElement t0 = Z + Z;
    r.X = r.Z - r.Y;
    r.Y = r.Z + r.Y;
    r.Z = t0 - r.T;
    r.T = t0 + r.T;
    return r;
  }

  throw ArgumentError('invalid argument');
}