pyecsca.ec.mult.ladder module¶
Provides ladder-based scalar multipliers, either using the ladder formula, or (diffadd, dbl) or (add, dbl).
- class LadderMultiplier(ladd, dbl=None, scl=None, complete=True, short_circuit=True)[source]¶
Bases:
ScalarMultiplier
Montgomery ladder multiplier, using a three input, two output ladder formula.
Optionally takes a doubling formula, and if complete is false, it requires one.
- Parameters:
- requires: ClassVar[Set[Type]] = {<class 'pyecsca.ec.formula.base.LadderFormula'>}¶
The set of formula types that the multiplier requires.
- optionals: ClassVar[Set[Type]] = {<class 'pyecsca.ec.formula.base.DoublingFormula'>, <class 'pyecsca.ec.formula.base.ScalingFormula'>}¶
The optional set of formula types that the multiplier can use.
-
complete:
bool
¶ Whether it starts processing at full order-bit-length.
- multiply(scalar)[source]¶
Multiply the point with the scalar.
Note
The multiplier needs to be initialized by a call to the
init()
method.
- init(params, point)¶
Initialize the scalar multiplier with
params
and apoint
.Warning
The point is not verified to be on the curve represented in the domain parameters.
- Parameters:
params¶ (
DomainParameters
) – The domain parameters to initialize the multiplier with.point¶ (
Point
) – The point to initialize the multiplier with.
- short_circuit: bool¶
Whether the formulas will short-circuit upon input of the point at infinity.
- formulas: Mapping[str, Formula]¶
All formulas the multiplier was initialized with.
- class SimpleLadderMultiplier(add, dbl, scl=None, complete=True, short_circuit=True)[source]¶
Bases:
ScalarMultiplier
Montgomery ladder multiplier, using addition and doubling formulas.
- Parameters:
- requires: ClassVar[Set[Type]] = {<class 'pyecsca.ec.formula.base.AdditionFormula'>, <class 'pyecsca.ec.formula.base.DoublingFormula'>}¶
The set of formula types that the multiplier requires.
- optionals: ClassVar[Set[Type]] = {<class 'pyecsca.ec.formula.base.ScalingFormula'>}¶
The optional set of formula types that the multiplier can use.
-
complete:
bool
¶ Whether it starts processing at full order-bit-length.
- multiply(scalar)[source]¶
Multiply the point with the scalar.
Note
The multiplier needs to be initialized by a call to the
init()
method.
- init(params, point)¶
Initialize the scalar multiplier with
params
and apoint
.Warning
The point is not verified to be on the curve represented in the domain parameters.
- Parameters:
params¶ (
DomainParameters
) – The domain parameters to initialize the multiplier with.point¶ (
Point
) – The point to initialize the multiplier with.
- short_circuit: bool¶
Whether the formulas will short-circuit upon input of the point at infinity.
- formulas: Mapping[str, Formula]¶
All formulas the multiplier was initialized with.
- class DifferentialLadderMultiplier(dadd, dbl, scl=None, complete=True, short_circuit=True)[source]¶
Bases:
ScalarMultiplier
Montgomery ladder multiplier, using differential addition and doubling formulas.
- Parameters:
- requires: ClassVar[Set[Type]] = {<class 'pyecsca.ec.formula.base.DifferentialAdditionFormula'>, <class 'pyecsca.ec.formula.base.DoublingFormula'>}¶
The set of formula types that the multiplier requires.
- optionals: ClassVar[Set[Type]] = {<class 'pyecsca.ec.formula.base.ScalingFormula'>}¶
The optional set of formula types that the multiplier can use.
- init(params, point)¶
Initialize the scalar multiplier with
params
and apoint
.Warning
The point is not verified to be on the curve represented in the domain parameters.
- Parameters:
params¶ (
DomainParameters
) – The domain parameters to initialize the multiplier with.point¶ (
Point
) – The point to initialize the multiplier with.
- short_circuit: bool¶
Whether the formulas will short-circuit upon input of the point at infinity.
- formulas: Mapping[str, Formula]¶
All formulas the multiplier was initialized with.
-
complete:
bool
¶ Whether it starts processing at full order-bit-length.