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()
>>> coordinate_model.formulas  
{'mdbl-2007-bl': DoublingEFDFormula(mdbl-2007-bl for shortw/projective),
 'dbl-2007-bl': DoublingEFDFormula(dbl-2007-bl for shortw/projective),
  ...
 'add-2007-bl': AdditionEFDFormula(add-2007-bl for shortw/projective),
  ...
name: str

Name of the coordinate model

full_name: str

Full name.

curve_model: Any

The curve model.

variables: List[str]

Variables that the coordinate model uses.

satisfying: List[Module]

Relationship between the coordinate system and affine coordinates.

toaffine: List[Module]

Map to affine coordinates from system coordinates.

tosystem: List[Module]

Map from coordinate system to affine coordinates.

homogweights: MutableMapping[str, int]

Weights that homogenize the coordinates.

parameters: List[str]

Coordinate system parameters.

assumptions: List[Module]

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]

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

formulas: MutableMapping[str, Formula]

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'

Name of the coordinate model

full_name: str = 'Affine coordinates'

Full name.

curve_model: Any

The curve model.

variables: List[str]

Variables that the coordinate model uses.

satisfying: List[Module]

Relationship between the coordinate system and affine coordinates.

toaffine: List[Module]

Map to affine coordinates from system coordinates.

tosystem: List[Module]

Map from coordinate system to affine coordinates.

parameters: List[str]

Coordinate system parameters.

assumptions: List[Module]

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]

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

formulas: MutableMapping[str, Formula]

Formulas available on the coordinate system.

homogweights: MutableMapping[str, int]

Weights that homogenize the coordinates.