pyecsca.ec.point module

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

class 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[source]
model_to: CoordinateModel[source]
point: Point[source]
exit(result)[source]
property result: Any[source]

The result of the action.

inside: bool[source]
class Point(model, **coords)[source]

Bases: object

A point with coordinates in a coordinate model.

coordinate_model: CoordinateModel[source]
coords: Mapping[str, Mod][source]
field: int[source]
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 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[source]
coords: Mapping[str, Mod][source]
field: int[source]