pyecsca.ec.formula.base module¶
Provides an abstract base class of a formula.
- class pyecsca.ec.formula.base.OpResult(name, value, op, *parents)[source]¶
Bases:
object
Result of an operation.
-
parents:
Tuple
¶
-
name:
str
¶
-
parents:
- class pyecsca.ec.formula.base.FormulaAction(formula, *points, **inputs)[source]¶
Bases:
ResultAction
Execution of a formula, on some input points and parameters, with some outputs.
-
input_points:
List
[Any
]¶ The input points.
-
output_points:
List
[Any
]¶ The output points.
- exit(result)¶
- property result: Any¶
-
inside:
bool
¶
-
input_points:
- class pyecsca.ec.formula.base.Formula[source]¶
Bases:
ABC
Formula operating on points.
-
name:
str
¶ Name of the formula.
-
shortname:
ClassVar
[str
]¶ 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).
-
num_inputs:
ClassVar
[int
]¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
]¶ Number of outputs (points) of the formula.
-
unified:
bool
¶ Whether the formula specifies that it is unified.
- property assumptions_str¶
- property input_index¶
Return the starting index where this formula reads its inputs.
- property output_index¶
Return the starting index where this formula stores its outputs.
- property inputs¶
Return the input variables of the formula.
- property outputs¶
Return the output variables of the formula.
- property num_operations: int¶
Return the number of operations.
- property num_multiplications: int¶
Return the number of multiplications.
- property num_divisions: int¶
Return the number of divisions.
- property num_inversions: int¶
Return the number of inversions.
- property num_powers: int¶
Return the number of powers.
- property num_squarings: int¶
Return the number of squarings.
- property num_addsubs: int¶
Return the number of additions and subtractions.
-
name:
- class pyecsca.ec.formula.base.AdditionFormula[source]¶
Bases:
Formula
,ABC
Formula that adds two points.
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'add'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 2¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 1¶ Number of outputs (points) of the formula.
- class pyecsca.ec.formula.base.DoublingFormula[source]¶
Bases:
Formula
,ABC
Formula that doubles a point.
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'dbl'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 1¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 1¶ Number of outputs (points) of the formula.
- class pyecsca.ec.formula.base.TriplingFormula[source]¶
Bases:
Formula
,ABC
Formula that triples a point.
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'tpl'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 1¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 1¶ Number of outputs (points) of the formula.
- class pyecsca.ec.formula.base.NegationFormula[source]¶
Bases:
Formula
,ABC
Formula that negates a point.
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'neg'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 1¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 1¶ Number of outputs (points) of the formula.
- class pyecsca.ec.formula.base.ScalingFormula[source]¶
Bases:
Formula
,ABC
Formula that somehow scales the point (to a given representative of a projective class).
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'scl'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 1¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 1¶ Number of outputs (points) of the formula.
- class pyecsca.ec.formula.base.DifferentialAdditionFormula[source]¶
Bases:
Formula
,ABC
Differential addition formula that adds two points with a known difference.
The first input point is the difference of the third input and the second input (P[0] = P[2] - P[1]).
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'dadd'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 3¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 1¶ Number of outputs (points) of the formula.
- class pyecsca.ec.formula.base.LadderFormula[source]¶
Bases:
Formula
,ABC
Ladder formula for simultaneous addition of two points and doubling of the one of them, with a known difference.
The first input point is the difference of the third input and the second input (P[0] = P[2] - P[1]). The first output point is the doubling of the second input point (O[0] = 2 * P[1]). The second output point is the addition of the second and third input points (O[1] = P[1] + P[2]).
- 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.
- 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.
- 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.
-
name:
str
¶ Name 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).
-
unified:
bool
¶ Whether the formula specifies that it is unified.
-
shortname:
ClassVar
[str
] = 'ladd'¶ A shortname for the type of the formula.
-
num_inputs:
ClassVar
[int
] = 3¶ Number of inputs (points) of the formula.
-
num_outputs:
ClassVar
[int
] = 2¶ Number of outputs (points) of the formula.