pyecsca.ec.coordinates module

Provides a coordinate model class.

class CoordinateModel[source]

Bases: object

A coordinate system for a particular model(form) of an elliptic curve.

>>> from pyecsca.ec.params import get_params
>>> params = get_params("secg", "secp256r1", "projective")
>>> coordinate_model = params.curve.coordinate_model
>>> coordinate_model
EFDCoordinateModel("projective", curve_model=ShortWeierstrass)
>>> coordinate_model.variables
['X', 'Y', 'Z']
>>> coordinate_model.curve_model
ShortWeierstrassModel()
>>> sorted(coordinate_model.formulas.items())  
[('add-1998-cmo', AdditionEFDFormula(add-1998-cmo for shortw/projective)),
 ('add-1998-cmo-2', AdditionEFDFormula(add-1998-cmo-2 for shortw/projective)),
 ...
 ('dbl-2007-bl', DoublingEFDFormula(dbl-2007-bl for shortw/projective)),
 ...]
name: str[source]

Name of the coordinate model

full_name: str[source]

Full name.

curve_model: Any[source]

The curve model.

variables: List[str][source]

Variables that the coordinate model uses.

satisfying: List[Module][source]

Relationship between the coordinate system and affine coordinates.

toaffine: List[Module][source]

Map to affine coordinates from system coordinates.

tosystem: List[Module][source]

Map from coordinate system to affine coordinates.

homogweights: MutableMapping[str, int][source]

Weights that homogenize the coordinates.

parameters: List[str][source]

Coordinate system parameters.

assumptions: List[Module][source]

Assumptions that need to hold for the curve to use this coordinate system, also used to compute the values of the coordinate system parameters.

neutral: List[Module][source]

Coordinates of the neutral point in the coordinate system, might contain expressions of parameters.

formulas: MutableMapping[str, Formula][source]

Formulas available on the coordinate system.

class AffineCoordinateModel(curve_model)[source]

Bases: CoordinateModel

An affine coordinate model (there is really only one per curve model).

name: str = 'affine'[source]

Name of the coordinate model

full_name: str = 'Affine coordinates'[source]

Full name.

curve_model: Any[source]

The curve model.

variables: List[str][source]

Variables that the coordinate model uses.

satisfying: List[Module][source]

Relationship between the coordinate system and affine coordinates.

toaffine: List[Module][source]

Map to affine coordinates from system coordinates.

tosystem: List[Module][source]

Map from coordinate system to affine coordinates.

parameters: List[str][source]

Coordinate system parameters.

assumptions: List[Module][source]

Assumptions that need to hold for the curve to use this coordinate system, also used to compute the values of the coordinate system parameters.

neutral: List[Module][source]

Coordinates of the neutral point in the coordinate system, might contain expressions of parameters.

formulas: MutableMapping[str, Formula][source]

Formulas available on the coordinate system.

homogweights: MutableMapping[str, int][source]

Weights that homogenize the coordinates.