doublePoint method
Double an Edwards curve point.
This method computes the result of doubling an Edwards curve point on the same curve. It calculates the new coordinates and returns them as a list.
Parameters:
x1
: x-coordinate of the point.y1
: y-coordinate of the point.z1
: z-coordinate of the point.t1
: t-coordinate of the point.p
: The prime modulus of the curve.a
: The 'a' parameter of the curve equation.
Returns:
- A list of BigInt values representing the new coordinates
x3, y3, z3, t3
after doubling the point.
Implementation
@override
EDPoint doublePoint() {
BigInt x1 = _coords[0];
BigInt t1 = _coords[3];
BigInt p = curve.p;
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);
}