double method
Doubles the ProjectivAffinePoint by performing point doubling operation.
Implementation
ProjectivAffinePoint double() {
if (isZero()) {
return ProjectivAffinePoint(curve, BigInt.zero, BigInt.zero);
}
final BigInt p = curve.p;
final BigInt a = curve.a;
final BigInt l =
(BigInt.from(3) * x * x + a) *
BigintUtils.inverseMod(BigInt.from(2) * y, p) %
p;
final BigInt x3 = (l * l - BigInt.from(2) * x) % p;
final BigInt y3 = (l * (x - x3) - y) % p;
return ProjectivAffinePoint(curve, x3, y3, order: null);
}