pyecsca.ec.formula.fake module

class pyecsca.ec.formula.fake.FakeAdditionFormula(coordinate_model)[source]

Bases: FakeFormula, AdditionFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 2

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 1

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'add'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakeDoublingFormula(coordinate_model)[source]

Bases: FakeFormula, DoublingFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 1

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 1

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'dbl'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakeTriplingFormula(coordinate_model)[source]

Bases: FakeFormula, TriplingFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 1

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 1

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'tpl'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakeNegationFormula(coordinate_model)[source]

Bases: FakeFormula, NegationFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 1

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 1

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'neg'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakeScalingFormula(coordinate_model)[source]

Bases: FakeFormula, ScalingFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 1

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 1

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'scl'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakeDifferentialAdditionFormula(coordinate_model)[source]

Bases: FakeFormula, DifferentialAdditionFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 3

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 1

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'dadd'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakeLadderFormula(coordinate_model)[source]

Bases: FakeFormula, LadderFormula

name: str = 'fake'

Name of the formula.

property assumptions_str
property input_index

Return the starting index where this formula reads its inputs.

property inputs

Return the input variables of the formula.

property num_addsubs: int

Return the number of additions and subtractions.

property num_divisions: int

Return the number of divisions.

num_inputs: ClassVar[int] = 3

Number of inputs (points) of the formula.

property num_inversions: int

Return the number of inversions.

property num_multiplications: int

Return the number of multiplications.

property num_operations: int

Return the number of operations.

num_outputs: ClassVar[int] = 2

Number of outputs (points) of the formula.

property num_powers: int

Return the number of powers.

property num_squarings: int

Return the number of squarings.

property output_index

Return the starting index where this formula stores its outputs.

property outputs

Return the output variables of the formula.

shortname: ClassVar[str] = 'ladd'

A shortname for the type of the formula.

coordinate_model: Any

Coordinate model of the formula.

meta: MutableMapping[str, Any]

Meta information about the formula, such as its source.

parameters: List[str]

Formula parameters (i.e. new parameters introduced by the formula, like half = 1/2).

assumptions: List[Expression]

Assumptions of the formula (e.g. Z1 == 1 or 2*half == 1).

code: List[CodeOp]

The collection of ops that constitute the code of the formula.

unified: bool

Whether the formula specifies that it is unified.

class pyecsca.ec.formula.fake.FakePoint(model)[source]

Bases: Point

equals(other)

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

Return type:

bool

equals_affine(other)

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

Return type:

bool

equals_scaled(other)

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.

to_affine()

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

Return type:

Point

to_model(coordinate_model, curve, randomized=False)

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

Return type:

Point

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