double method
Doubles a point in projective coordinates on an elliptic curve and returns the result.
Implementation
@override
ProjectiveECCPoint double() {
final BigInt x1 = _coords[0];
final BigInt y1 = _coords[1];
final BigInt z1 = _coords[2];
if (y1 == BigInt.zero) {
// If y-coordinate is zero, the result is the point at infinity
return ProjectiveECCPoint.infinity(curve);
}
final BigInt primeField = curve.p;
final BigInt curveA = curve.a;
final List<BigInt> result = _double(x1, y1, z1, primeField, curveA);
if (result[1] == BigInt.zero || result[2] == BigInt.zero) {
// If the y-coordinate or z-coordinate of the result is zero, return the point at infinity
return ProjectiveECCPoint.infinity(curve);
}
return ProjectiveECCPoint(
curve: curve,
x: result[0],
y: result[1],
z: result[2],
order: order,
);
}