diff options
| author | J08nY | 2025-03-13 19:38:48 +0100 |
|---|---|---|
| committer | J08nY | 2025-03-13 19:38:48 +0100 |
| commit | 7c2f12a0111de33330870b2179b71281b59ada29 (patch) | |
| tree | 80beb7f4e3090a4805d7aa20ffba5cbcc0078902 /pyecsca/ec | |
| parent | eccc58127b4c0c10f50e4d05e699d3585391e8a1 (diff) | |
| download | pyecsca-7c2f12a0111de33330870b2179b71281b59ada29.tar.gz pyecsca-7c2f12a0111de33330870b2179b71281b59ada29.tar.zst pyecsca-7c2f12a0111de33330870b2179b71281b59ada29.zip | |
Diffstat (limited to 'pyecsca/ec')
| -rw-r--r-- | pyecsca/ec/configuration.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/coordinates.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/countermeasures.py | 18 | ||||
| -rw-r--r-- | pyecsca/ec/curve.py | 89 | ||||
| -rw-r--r-- | pyecsca/ec/divpoly.py | 9 | ||||
| -rw-r--r-- | pyecsca/ec/error.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/formula/base.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/formula/code.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/formula/efd.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/formula/fake.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/formula/fliparoo.py | 2 | ||||
| -rw-r--r-- | pyecsca/ec/formula/graph.py | 5 | ||||
| -rw-r--r-- | pyecsca/ec/formula/metrics.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/key_generation.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/model.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/mult/binary.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/mult/comb.py | 4 | ||||
| -rw-r--r-- | pyecsca/ec/mult/fake.py | 14 | ||||
| -rw-r--r-- | pyecsca/ec/mult/fixed.py | 4 | ||||
| -rw-r--r-- | pyecsca/ec/mult/naf.py | 4 | ||||
| -rw-r--r-- | pyecsca/ec/mult/window.py | 16 | ||||
| -rw-r--r-- | pyecsca/ec/op.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/point.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/scalar.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/signature.py | 1 | ||||
| -rw-r--r-- | pyecsca/ec/transformations.py | 1 |
26 files changed, 132 insertions, 49 deletions
diff --git a/pyecsca/ec/configuration.py b/pyecsca/ec/configuration.py index 40ca59b..a8c5fee 100644 --- a/pyecsca/ec/configuration.py +++ b/pyecsca/ec/configuration.py @@ -1,4 +1,5 @@ """Provides a way to work with and enumerate implementation configurations.""" + import warnings from abc import ABC from dataclasses import dataclass diff --git a/pyecsca/ec/coordinates.py b/pyecsca/ec/coordinates.py index 9dcdbbe..8a42b7b 100644 --- a/pyecsca/ec/coordinates.py +++ b/pyecsca/ec/coordinates.py @@ -1,4 +1,5 @@ """Provides a coordinate model class.""" + from ast import parse, Module from importlib_resources.abc import Traversable from importlib_resources import as_file diff --git a/pyecsca/ec/countermeasures.py b/pyecsca/ec/countermeasures.py index 19afb06..9fd743a 100644 --- a/pyecsca/ec/countermeasures.py +++ b/pyecsca/ec/countermeasures.py @@ -60,6 +60,7 @@ class GroupScalarRandomization(ScalarMultiplierCountermeasure): &\textbf{return}\ [k + r n]G """ + rand_bits: int def __init__(self, mult: ScalarMultiplier, rand_bits: int = 32): @@ -73,7 +74,11 @@ class GroupScalarRandomization(ScalarMultiplierCountermeasure): def init(self, params: DomainParameters, point: Point): self.params = params self.point = point - self.mult.init(self.params, self.point, bits=params.full_order.bit_length() + self.rand_bits) + self.mult.init( + self.params, + self.point, + bits=params.full_order.bit_length() + self.rand_bits, + ) def multiply(self, scalar: int) -> Point: if self.params is None or self.point is None: @@ -99,6 +104,7 @@ class AdditiveSplitting(ScalarMultiplierCountermeasure): &\textbf{return}\ [k - r]G + [r]G """ + add: Optional[AdditionFormula] def __init__(self, mult: ScalarMultiplier, add: Optional[AdditionFormula] = None): @@ -121,7 +127,9 @@ class AdditiveSplitting(ScalarMultiplierCountermeasure): if self.add is None: res = self.mult._add(R, S) # noqa: This is OK. else: - res = self.add(self.params.curve.prime, R, S, **self.params.curve.parameters)[0] + res = self.add( + self.params.curve.prime, R, S, **self.params.curve.parameters + )[0] return action.exit(res) @@ -140,6 +148,7 @@ class MultiplicativeSplitting(ScalarMultiplierCountermeasure): &\textbf{return}\ [k r^{-1} \mod n]S """ + rand_bits: int def __init__(self, mult: ScalarMultiplier, rand_bits: int = 32): @@ -180,6 +189,7 @@ class EuclideanSplitting(ScalarMultiplierCountermeasure): &\textbf{return}\ [k_1]G + [k_2]S """ + add: Optional[AdditionFormula] def __init__(self, mult: ScalarMultiplier, add: Optional[AdditionFormula] = None): @@ -208,5 +218,7 @@ class EuclideanSplitting(ScalarMultiplierCountermeasure): if self.add is None: res = self.mult._add(S, T) # noqa: This is OK. else: - res = self.add(self.params.curve.prime, S, T, **self.params.curve.parameters)[0] + res = self.add( + self.params.curve.prime, S, T, **self.params.curve.parameters + )[0] return action.exit(res) diff --git a/pyecsca/ec/curve.py b/pyecsca/ec/curve.py index 8a3c726..67feb60 100644 --- a/pyecsca/ec/curve.py +++ b/pyecsca/ec/curve.py @@ -1,4 +1,5 @@ """Provides an elliptic curve class.""" + from ast import Module from astunparse import unparse from copy import copy @@ -68,21 +69,21 @@ class EllipticCurve: """The neutral point on the curve.""" def __init__( - self, - model: CurveModel, - coordinate_model: CoordinateModel, - prime: int, - neutral: Point, - parameters: MutableMapping[str, Union[Mod, int]], + self, + model: CurveModel, + coordinate_model: CoordinateModel, + prime: int, + neutral: Point, + parameters: MutableMapping[str, Union[Mod, int]], ): if coordinate_model not in model.coordinates.values() and not isinstance( - coordinate_model, AffineCoordinateModel + coordinate_model, AffineCoordinateModel ): raise ValueError if ( - set(model.parameter_names) - .union(coordinate_model.parameters) - .symmetric_difference(parameters.keys()) + set(model.parameter_names) + .union(coordinate_model.parameters) + .symmetric_difference(parameters.keys()) ): raise ValueError self.model = model @@ -130,7 +131,7 @@ class EllipticCurve: if k.from_sympy(expr) != 0: raise_unsatisified_assumption( getconfig().ec.unsatisfied_coordinate_assumption_action, - f"Coordinate model {self.coordinate_model} has an unsatisifed assumption on the {param} parameter (0 = {expr})." + f"Coordinate model {self.coordinate_model} has an unsatisifed assumption on the {param} parameter (0 = {expr}).", ) def _execute_base_formulas(self, formulas: List[Module], *points: Point) -> Point: @@ -146,7 +147,9 @@ class EllipticCurve: } locls.update(self.parameters) for line in formulas: - exec(compile(line, "", mode="exec"), None, locls) # exec is OK here, skipcq: PYL-W0122 + exec( + compile(line, "", mode="exec"), None, locls + ) # exec is OK here, skipcq: PYL-W0122 if not isinstance(locls["x"], Mod): locls["x"] = mod(locls["x"], self.prime) if not isinstance(locls["y"], Mod): @@ -233,7 +236,9 @@ class EllipticCurve: return None locls = {**self.parameters} for line in self.model.base_neutral: - exec(compile(line, "", mode="exec"), None, locls) # exec is OK here, skipcq: PYL-W0122 + exec( + compile(line, "", mode="exec"), None, locls + ) # exec is OK here, skipcq: PYL-W0122 if not isinstance(locls["x"], Mod): locls["x"] = mod(locls["x"], self.prime) if not isinstance(locls["y"], Mod): @@ -269,7 +274,9 @@ class EllipticCurve: loc = {**self.parameters, **point.coords} else: loc = {**self.parameters, **point.to_affine().coords} - return eval(compile(self.model.equation, "", mode="eval"), loc) # eval is OK here, skipcq: PYL-W0123 + return eval( + compile(self.model.equation, "", mode="eval"), loc + ) # eval is OK here, skipcq: PYL-W0123 def to_coords(self, coordinate_model: CoordinateModel) -> "EllipticCurve": """ @@ -280,8 +287,13 @@ class EllipticCurve: """ if not isinstance(self.coordinate_model, AffineCoordinateModel): raise ValueError - return EllipticCurve(self.model, coordinate_model, self.prime, self.neutral.to_model(coordinate_model, self), - self.parameters) # type: ignore[arg-type] + return EllipticCurve( + self.model, + coordinate_model, + self.prime, + self.neutral.to_model(coordinate_model, self), + self.parameters, + ) # type: ignore[arg-type] def to_affine(self) -> "EllipticCurve": """ @@ -290,8 +302,13 @@ class EllipticCurve: :return: The transformed elliptic curve. """ coord_model = AffineCoordinateModel(self.model) - return EllipticCurve(self.model, coord_model, self.prime, self.neutral.to_affine(), - self.parameters) # type: ignore[arg-type] + return EllipticCurve( + self.model, + coord_model, + self.prime, + self.neutral.to_affine(), + self.parameters, + ) # type: ignore[arg-type] def decode_point(self, encoded: bytes) -> Point: """ @@ -325,7 +342,9 @@ class EllipticCurve: raise ValueError("Encoded point has bad length") x = mod(int.from_bytes(data, "big"), self.prime) loc = {**self.parameters, "x": x} - rhs = eval(compile(self.model.ysquared, "", mode="eval"), loc) # eval is OK here, skipcq: PYL-W0123 + rhs = eval( + compile(self.model.ysquared, "", mode="eval"), loc + ) # eval is OK here, skipcq: PYL-W0123 if not rhs.is_residue(): raise ValueError("Point not on curve") sqrt = rhs.sqrt() @@ -350,19 +369,25 @@ class EllipticCurve: :return: Lifted (affine) points, if any. """ loc = {**self.parameters, "x": x} - ysquared = eval(compile(self.model.ysquared, "", mode="eval"), loc) # eval is OK here, skipcq: PYL-W0123 + ysquared = eval( + compile(self.model.ysquared, "", mode="eval"), loc + ) # eval is OK here, skipcq: PYL-W0123 if not ysquared.is_residue(): return set() y = ysquared.sqrt() - return {Point(AffineCoordinateModel(self.model), x=x, y=y), - Point(AffineCoordinateModel(self.model), x=x, y=-y)} + return { + Point(AffineCoordinateModel(self.model), x=x, y=y), + Point(AffineCoordinateModel(self.model), x=x, y=-y), + } def affine_random(self) -> Point: """Generate a random affine point on the curve.""" while True: x = Mod.random(self.prime) loc = {**self.parameters, "x": x} - ysquared = eval(compile(self.model.ysquared, "", mode="eval"), loc) # eval is OK here, skipcq: PYL-W0123 + ysquared = eval( + compile(self.model.ysquared, "", mode="eval"), loc + ) # eval is OK here, skipcq: PYL-W0123 if ysquared.is_residue(): y = ysquared.sqrt() b = Mod.random(2) @@ -374,14 +399,22 @@ class EllipticCurve: if not isinstance(other, EllipticCurve): return False return ( - self.model == other.model - and self.coordinate_model == other.coordinate_model - and self.prime == other.prime - and self.parameters == other.parameters + self.model == other.model + and self.coordinate_model == other.coordinate_model + and self.prime == other.prime + and self.parameters == other.parameters ) def __hash__(self): - return hash((self.model, self.coordinate_model, self.prime, tuple(self.parameters.keys()), tuple(self.parameters.values()))) + return hash( + ( + self.model, + self.coordinate_model, + self.prime, + tuple(self.parameters.keys()), + tuple(self.parameters.values()), + ) + ) def __str__(self): return "EllipticCurve" diff --git a/pyecsca/ec/divpoly.py b/pyecsca/ec/divpoly.py index 96b7bf3..0809f94 100644 --- a/pyecsca/ec/divpoly.py +++ b/pyecsca/ec/divpoly.py @@ -1,6 +1,7 @@ """ Provides functions for computing division polynomials and the multiplication-by-n map on an elliptic curve. """ + from typing import Tuple, Dict, Set, Mapping, Optional from public import public import warnings @@ -161,9 +162,7 @@ def divpoly0(curve: EllipticCurve, *ns: int) -> Mapping[int, Poly]: elif i in (1, 2): val = Kx(1) elif i == 3: - val = ( - Kx(3) * x**4 + b2 * x**3 + Kx(3) * b4 * x**2 + Kx(3) * b6 * x + b8 - ) + val = Kx(3) * x**4 + b2 * x**3 + Kx(3) * b4 * x**2 + Kx(3) * b6 * x + b8 elif i == 4: val = -mem[-2] + (Kx(6) * x**2 + b2 * x + b4) * mem[3] elif i % 2 == 0: @@ -293,7 +292,9 @@ def mult_by_n( mx = mult_by_n_pari(curve, n) else: if use_pari: - warnings.warn("Falling-back to slow mult-by-n map computation due to missing [pari] (cypari2 and libpari) dependency.") + warnings.warn( + "Falling-back to slow mult-by-n map computation due to missing [pari] (cypari2 and libpari) dependency." + ) mx = mult_by_n_own(curve, n) if x_only: diff --git a/pyecsca/ec/error.py b/pyecsca/ec/error.py index b9cd7e7..003292e 100644 --- a/pyecsca/ec/error.py +++ b/pyecsca/ec/error.py @@ -1,4 +1,5 @@ """Contains exceptions and warnings used in the library.""" + import warnings from public import public from pyecsca.misc.cfg import getconfig diff --git a/pyecsca/ec/formula/base.py b/pyecsca/ec/formula/base.py index 04d6c19..a556367 100644 --- a/pyecsca/ec/formula/base.py +++ b/pyecsca/ec/formula/base.py @@ -1,4 +1,5 @@ """Provides an abstract base class of a formula.""" + from abc import ABC from ast import Expression from functools import cached_property diff --git a/pyecsca/ec/formula/code.py b/pyecsca/ec/formula/code.py index f24cfc6..6eca838 100644 --- a/pyecsca/ec/formula/code.py +++ b/pyecsca/ec/formula/code.py @@ -1,4 +1,5 @@ """Provides a concrete class of a formula that has a constructor and some code.""" + from typing import List, Any from ast import Expression from astunparse import unparse diff --git a/pyecsca/ec/formula/efd.py b/pyecsca/ec/formula/efd.py index 7796c11..f837da2 100644 --- a/pyecsca/ec/formula/efd.py +++ b/pyecsca/ec/formula/efd.py @@ -1,4 +1,5 @@ """Provides formulas wrapping the [EFD]_.""" + from copy import copy from public import public diff --git a/pyecsca/ec/formula/fake.py b/pyecsca/ec/formula/fake.py index 612712d..8b71df6 100644 --- a/pyecsca/ec/formula/fake.py +++ b/pyecsca/ec/formula/fake.py @@ -1,4 +1,5 @@ """Provides "fake" formulas.""" + from abc import ABC from typing import Any, Tuple diff --git a/pyecsca/ec/formula/fliparoo.py b/pyecsca/ec/formula/fliparoo.py index 4d14f80..7b8d951 100644 --- a/pyecsca/ec/formula/fliparoo.py +++ b/pyecsca/ec/formula/fliparoo.py @@ -1,4 +1,5 @@ """Provides a way to Fliparoo formulas.""" + from ast import parse from typing import Iterator, List, Type, Optional from public import public @@ -173,7 +174,6 @@ def largest_fliparoo( class SignedNode: - """ Represents a summand in an expression X1-X2+X3+X4-X5... Used for creating +/- Fliparoos diff --git a/pyecsca/ec/formula/graph.py b/pyecsca/ec/formula/graph.py index e2fb1ee..3020ea9 100644 --- a/pyecsca/ec/formula/graph.py +++ b/pyecsca/ec/formula/graph.py @@ -1,4 +1,5 @@ """Provides tools for working with formulas as graphs.""" + import matplotlib.pyplot as plt import networkx as nx from ast import parse, Expression @@ -283,7 +284,9 @@ class FormulaGraph: def networkx_graph(self) -> nx.DiGraph: graph = nx.DiGraph() for i, node in enumerate(self.nodes): - graph.add_node(i, result=node.result, label=node.label, op=getattr(node, "op", None)) + graph.add_node( + i, result=node.result, label=node.label, op=getattr(node, "op", None) + ) for node in self.nodes: for out in node.outgoing_nodes: graph.add_edge(self.node_index(node), self.node_index(out)) diff --git a/pyecsca/ec/formula/metrics.py b/pyecsca/ec/formula/metrics.py index 31d0545..f2e9166 100644 --- a/pyecsca/ec/formula/metrics.py +++ b/pyecsca/ec/formula/metrics.py @@ -1,4 +1,5 @@ """Provides metrics for comparing formulas.""" + import warnings from public import public diff --git a/pyecsca/ec/key_generation.py b/pyecsca/ec/key_generation.py index c583160..f67ad67 100644 --- a/pyecsca/ec/key_generation.py +++ b/pyecsca/ec/key_generation.py @@ -1,4 +1,5 @@ """Provides a key generator for elliptic curve keypairs.""" + from typing import Tuple from public import public diff --git a/pyecsca/ec/model.py b/pyecsca/ec/model.py index d90f337..15affa2 100644 --- a/pyecsca/ec/model.py +++ b/pyecsca/ec/model.py @@ -1,4 +1,5 @@ """Provides curve model classes for the supported curve models.""" + from ast import parse, Expression, Module from typing import List, MutableMapping from importlib_resources import files, as_file diff --git a/pyecsca/ec/mult/binary.py b/pyecsca/ec/mult/binary.py index f0cb5ac..3dc22c3 100644 --- a/pyecsca/ec/mult/binary.py +++ b/pyecsca/ec/mult/binary.py @@ -1,4 +1,5 @@ """Provides binary scalar multipliers (LTR and RTL), that process the scalar as-is, bit-by-bit.""" + from abc import ABC from copy import copy from typing import Optional diff --git a/pyecsca/ec/mult/comb.py b/pyecsca/ec/mult/comb.py index 1a6c0c2..3e064d2 100644 --- a/pyecsca/ec/mult/comb.py +++ b/pyecsca/ec/mult/comb.py @@ -1,4 +1,5 @@ """Provides Comb-like scalar multipliers, such as BGMW or Lim-Lee.""" + from copy import copy from math import ceil from typing import MutableMapping, Optional @@ -12,7 +13,8 @@ from pyecsca.ec.mult import ( ProcessingDirection, AccumulationOrder, PrecomputationAction, - ScalarMultiplicationAction, PrecompMultiplier, + ScalarMultiplicationAction, + PrecompMultiplier, ) from pyecsca.ec.params import DomainParameters from pyecsca.ec.point import Point diff --git a/pyecsca/ec/mult/fake.py b/pyecsca/ec/mult/fake.py index 391696b..d3f5b09 100644 --- a/pyecsca/ec/mult/fake.py +++ b/pyecsca/ec/mult/fake.py @@ -1,13 +1,21 @@ from typing import List, Type, Callable -from pyecsca.ec.formula import Formula, AdditionFormula, DifferentialAdditionFormula, DoublingFormula, LadderFormula, \ - NegationFormula +from pyecsca.ec.formula import ( + Formula, + AdditionFormula, + DifferentialAdditionFormula, + DoublingFormula, + LadderFormula, + NegationFormula, +) from pyecsca.ec.formula.fake import FakeFormula from pyecsca.ec.mult import ScalarMultiplier from pyecsca.ec.params import DomainParameters -def fake_mult(mult_class: Type[ScalarMultiplier], mult_factory: Callable, params: DomainParameters) -> ScalarMultiplier: +def fake_mult( + mult_class: Type[ScalarMultiplier], mult_factory: Callable, params: DomainParameters +) -> ScalarMultiplier: """ Get a multiplier with `FakeFormula`s. diff --git a/pyecsca/ec/mult/fixed.py b/pyecsca/ec/mult/fixed.py index 070aaec..4b817e9 100644 --- a/pyecsca/ec/mult/fixed.py +++ b/pyecsca/ec/mult/fixed.py @@ -1,4 +1,5 @@ """Provides fixed-base scalar multipliers that do a lot of pre-computation (but not combs).""" + from copy import copy from typing import MutableMapping, Optional @@ -11,7 +12,8 @@ from pyecsca.ec.mult.base import ( ProcessingDirection, AccumulationOrder, PrecomputationAction, - ScalarMultiplicationAction, PrecompMultiplier, + ScalarMultiplicationAction, + PrecompMultiplier, ) from pyecsca.ec.params import DomainParameters from pyecsca.ec.point import Point diff --git a/pyecsca/ec/mult/naf.py b/pyecsca/ec/mult/naf.py index b886552..f2e2bcc 100644 --- a/pyecsca/ec/mult/naf.py +++ b/pyecsca/ec/mult/naf.py @@ -1,4 +1,5 @@ """Provides scalar multipliers based on the Non Adjacent Form (NAF) recoding.""" + from copy import copy from typing import Optional, List, MutableMapping from public import public @@ -9,7 +10,8 @@ from pyecsca.ec.mult.base import ( ProcessingDirection, AccumulationOrder, PrecomputationAction, - AccumulatorMultiplier, PrecompMultiplier, + AccumulatorMultiplier, + PrecompMultiplier, ) from pyecsca.ec.formula import ( AdditionFormula, diff --git a/pyecsca/ec/mult/window.py b/pyecsca/ec/mult/window.py index 1a0ecec..1340e7e 100644 --- a/pyecsca/ec/mult/window.py +++ b/pyecsca/ec/mult/window.py @@ -1,4 +1,5 @@ """Provides sliding window and fixed window scalar multipliers (including m-ary, for non power-of-2 m).""" + from copy import copy from typing import Optional, MutableMapping from public import public @@ -10,7 +11,8 @@ from pyecsca.ec.mult.base import ( ScalarMultiplicationAction, PrecomputationAction, ProcessingDirection, - AccumulatorMultiplier, PrecompMultiplier, + AccumulatorMultiplier, + PrecompMultiplier, ) from pyecsca.ec.formula import ( AdditionFormula, @@ -28,7 +30,9 @@ from pyecsca.ec.scalar import ( @public -class SlidingWindowMultiplier(AccumulatorMultiplier, PrecompMultiplier, ScalarMultiplier): +class SlidingWindowMultiplier( + AccumulatorMultiplier, PrecompMultiplier, ScalarMultiplier +): """ Sliding window scalar multiplier. @@ -122,7 +126,9 @@ class SlidingWindowMultiplier(AccumulatorMultiplier, PrecompMultiplier, ScalarMu @public -class FixedWindowLTRMultiplier(AccumulatorMultiplier, PrecompMultiplier, ScalarMultiplier): +class FixedWindowLTRMultiplier( + AccumulatorMultiplier, PrecompMultiplier, ScalarMultiplier +): """ Like LTRMultiplier, but m-ary, not binary. @@ -322,9 +328,7 @@ class WindowBoothMultiplier(AccumulatorMultiplier, PrecompMultiplier, ScalarMult with ScalarMultiplicationAction(self._point, self._params, scalar) as action: if scalar == 0: return action.exit(copy(self._params.curve.neutral)) - scalar_booth = booth_window( - scalar, self.width, self._bits - ) + scalar_booth = booth_window(scalar, self.width, self._bits) q = copy(self._params.curve.neutral) for val in scalar_booth: for _ in range(self.width): diff --git a/pyecsca/ec/op.py b/pyecsca/ec/op.py index 250d6a3..5f03b50 100644 --- a/pyecsca/ec/op.py +++ b/pyecsca/ec/op.py @@ -1,4 +1,5 @@ """Provides a class for a code operation.""" + from ast import ( Module, walk, diff --git a/pyecsca/ec/point.py b/pyecsca/ec/point.py index 1b11e3f..162b9aa 100644 --- a/pyecsca/ec/point.py +++ b/pyecsca/ec/point.py @@ -1,4 +1,5 @@ """Provides a :py:class:`.Point` class and a special :py:class:`.InfinityPoint` class for the point at infinity.""" + from copy import copy from typing import Mapping, TYPE_CHECKING diff --git a/pyecsca/ec/scalar.py b/pyecsca/ec/scalar.py index 5d20634..dc6101c 100644 --- a/pyecsca/ec/scalar.py +++ b/pyecsca/ec/scalar.py @@ -1,4 +1,5 @@ """Provides functions for computing various scalar representations (like NAF, or different bases).""" + from typing import List from itertools import dropwhile from public import public diff --git a/pyecsca/ec/signature.py b/pyecsca/ec/signature.py index 088c931..b138607 100644 --- a/pyecsca/ec/signature.py +++ b/pyecsca/ec/signature.py @@ -1,4 +1,5 @@ """Provides an implementation of ECDSA (Elliptic Curve Digital Signature Algorithm).""" + import hashlib from typing import Optional, Any diff --git a/pyecsca/ec/transformations.py b/pyecsca/ec/transformations.py index 818a6dd..0be3684 100644 --- a/pyecsca/ec/transformations.py +++ b/pyecsca/ec/transformations.py @@ -1,4 +1,5 @@ """Provides functions for transforming curves to different models.""" + from typing import Tuple, Generator from public import public |
