pyecsca.ec.point module

Provides a Point class and a special InfinityPoint class for the point at infinity.

class pyecsca.ec.point.CoordinateMappingAction(model_from, model_to, point)[source]

Bases: ResultAction

A mapping of a point from one coordinate system to another one, usually one is an affine one.

model_from: CoordinateModel
model_to: CoordinateModel
point: Point
exit(result)
property result: Any
inside: bool
class pyecsca.ec.point.Point(model, **coords)[source]

Bases: object

A point with coordinates in a coordinate model.

coordinate_model: CoordinateModel
coords: Mapping[str, Mod]
field: int
to_affine()[source]

Convert this point into the affine coordinate model, if possible.

Return type:

Point

to_model(coordinate_model, curve, randomized=False)[source]

Convert an affine point into a given coordinate model, if possible.

Return type:

Point

equals_affine(other)[source]

Test whether this point is equal to other irrespective of the coordinate model (in the affine sense).

Return type:

bool

equals_scaled(other)[source]

Test whether this point is equal to other using the “z” scaling formula.

The “z” scaling formula maps the projective class to a single representative.

Parameters:

other (Point) – The point to compare

Raises:

ValueError – If the “z” formula is not available for the coordinate system.

Return type:

bool

Returns:

Whether the points are equal.

equals(other)[source]

Test whether this point is equal to other irrespective of the coordinate model (in the affine sense).

Return type:

bool

class pyecsca.ec.point.InfinityPoint(model)[source]

Bases: Point

A point at infinity.

to_affine()[source]

Convert this point into the affine coordinate model, if possible.

Return type:

InfinityPoint

to_model(coordinate_model, curve, randomized=False)[source]

Convert an affine point into a given coordinate model, if possible.

Return type:

InfinityPoint

equals_affine(other)[source]

Test whether this point is equal to other irrespective of the coordinate model (in the affine sense).

Return type:

bool

equals_scaled(other)[source]

Test whether this point is equal to other using the “z” scaling formula.

The “z” scaling formula maps the projective class to a single representative.

Parameters:

other (Point) – The point to compare

Raises:

ValueError – If the “z” formula is not available for the coordinate system.

Return type:

bool

Returns:

Whether the points are equal.

equals(other)[source]

Test whether this point is equal to other irrespective of the coordinate model (in the affine sense).

Return type:

bool

coordinate_model: CoordinateModel
coords: Mapping[str, Mod]
field: int