operator unary- method

EDPoint operator unary-()

Negation operator for an Edwards curve point.

This operator computes the negation (negate y-coordinate) of the Edwards curve point and returns a new Edwards curve point representing the negated point.

Implementation

EDPoint operator -() {
  final BigInt x1 = _coords[0];
  final BigInt y1 = _coords[1];
  final BigInt z1 = _coords[2];
  final BigInt t1 = _coords[3];
  final BigInt p = curve.p;
  return EDPoint._(
      curve,
      [
        (p - x1) % p, // NEGATE X
        y1, // KEEP Y
        z1, // KEEP Z
        (p - t1) % p // NEGATE T
      ],
      order: order);
}