pyecsca.ec.mult.fixed module

Provides fixed-base scalar multipliers that do a lot of pre-computation (but not combs).

class pyecsca.ec.mult.fixed.FullPrecompMultiplier(add, dbl, scl=None, always=False, direction=ProcessingDirection.LTR, accumulation_order=AccumulationOrder.PeqPR, complete=True, short_circuit=True)[source]

Bases: AccumulatorMultiplier, ScalarMultiplier

See page 104 of [GECC]:

For example, if the points [2]P,[2^2]P,…,[2^t−1]P are precomputed, then the right-to-left binary method (Algorithm 3.26) has expected running time (m/2)A (all doublings are eliminated).

Parameters:
  • always (bool) – Whether the addition is always performed.

  • direction (ProcessingDirection) – Whether it is LTR or RTL.

  • accumulation_order (AccumulationOrder) – The order of accumulation of points.

  • complete (bool) – Whether it starts processing at full order-bit-length.

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.

always: bool

Whether the double and add always method is used.

direction: ProcessingDirection

Whether it is LTR or RTL.

complete: bool

Whether it starts processing at full order-bit-length.

accumulation_order: AccumulationOrder

The order of accumulation of points.

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.

init(params, point)[source]

Initialize the scalar multiplier with params and a point.

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.

multiply(scalar)[source]

Multiply the point with the scalar.

Note

The multiplier needs to be initialized by a call to the init() method.

Parameters:

scalar (int) – The scalar to use.

Return type:

Point

Returns:

The resulting multiple.