pyecsca.ec.mult.base module¶
Provides (mostly abstract) base classes for scalar multipliers, enums used to specify their parameters and actions used in them.
- class ProcessingDirection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
Scalar processing direction.
- class AccumulationOrder(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
Accumulation order (makes a difference for the projective result).
- class ScalarMultiplicationAction(point, params, scalar)[source]¶
Bases:
ResultAction
A scalar multiplication of a point on a curve by a scalar.
-
params:
DomainParameters
[source]¶
-
params:
- class PrecomputationAction(params, point)[source]¶
Bases:
Action
A precomputation of a point in scalar multiplication.
-
params:
DomainParameters
[source]¶
-
params:
- class ScalarMultiplier(short_circuit=True, **formulas)[source]¶
Bases:
ABC
A scalar multiplication algorithm.
Note
The __init__ method of all concrete subclasses needs to have type annotations so that configuration enumeration works.
- Parameters:
-
optionals:
ClassVar
[Set
[Type
]][source]¶ The optional set of formula types that the multiplier can use.
-
short_circuit:
bool
[source]¶ Whether the formulas will short-circuit upon input of the point at infinity.
- init(params, point)[source]¶
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.
- class AccumulatorMultiplier(*args, accumulation_order=AccumulationOrder.PeqPR, **kwargs)[source]¶
Bases:
ScalarMultiplier
,ABC
A scalar multiplication algorithm mix-in class for a multiplier that accumulates.
- Parameters:
accumulation_order¶ (
AccumulationOrder
) – The order of accumulation of points.
- init(params, point)[source]¶
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.
- abstract multiply(scalar)[source]¶
Multiply the point with the scalar.
Note
The multiplier needs to be initialized by a call to the
init()
method.
-
optionals:
ClassVar
[Set
[Type
]][source]¶ The optional set of formula types that the multiplier can use.
-
short_circuit:
bool
[source]¶ Whether the formulas will short-circuit upon input of the point at infinity.
-
accumulation_order:
AccumulationOrder
[source]¶ The order of accumulation of points.