Representing a point
We call a
Pointan element of the elliptic curve group, which we can represent with its coordinates. Let's define a
Pointclass to encapsulate the and coordinates in the generalised curve equation of .
from typing import Optional
# Ignore validation for I
if self.x is None and self.y is None:
# Encapsulate int coordinates in FieldElement
self.x = FieldElement(self.x, self.curve.field)
self.y = FieldElement(self.y, self.curve.field)
# Verify if the point satisfies the curve equation
if self not in self.curve:
Point-compression: To reduce the storage size for a curve point, one can also store a sign and the
xcoordinate. It is then possible to reconstruct the
sign * sqrt(x^3+a*x+b).