double method

EDPoint double()

Double an Edwards curve point.

Implementation

EDPoint double() {
  final BigInt x1 = _coords[0];
  final BigInt t1 = _coords[3];
  final BigInt p = curve.p;
  final BigInt a = curve.a;

  if (x1 == BigInt.zero || t1 == BigInt.zero) {
    return EDPoint.infinity(curve: curve);
  }

  final newCoords = _double(x1, _coords[1], _coords[2], t1, p, a);
  if (newCoords[0] == BigInt.zero || newCoords[3] == BigInt.zero) {
    return EDPoint.infinity(curve: curve);
  }

  return EDPoint._(curve, newCoords, order: order);
}