diff options
| author | J08nY | 2023-07-28 16:23:08 +0200 |
|---|---|---|
| committer | J08nY | 2023-07-28 16:23:08 +0200 |
| commit | dc9e1cf991dc0b5bc89668e494f4a881398d5853 (patch) | |
| tree | ed82f02e608a500399283e9a88085fe8078ea3b0 /pyecsca/ec | |
| parent | 52da20650b3f25f11506fb5b773fd0df2a534c49 (diff) | |
| download | pyecsca-dc9e1cf991dc0b5bc89668e494f4a881398d5853.tar.gz pyecsca-dc9e1cf991dc0b5bc89668e494f4a881398d5853.tar.zst pyecsca-dc9e1cf991dc0b5bc89668e494f4a881398d5853.zip | |
Implement RPA-RE.
Diffstat (limited to 'pyecsca/ec')
| -rw-r--r-- | pyecsca/ec/mult.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pyecsca/ec/mult.py b/pyecsca/ec/mult.py index 9b13374..2effb10 100644 --- a/pyecsca/ec/mult.py +++ b/pyecsca/ec/mult.py @@ -155,6 +155,9 @@ class ScalarMultiplier(ABC): self._params.curve.prime, point, **self._params.curve.parameters )[0] + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, ScalarMultiplier): return False @@ -223,6 +226,9 @@ class LTRMultiplier(ScalarMultiplier): self.always = always self.complete = complete + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, LTRMultiplier): return False @@ -277,6 +283,9 @@ class RTLMultiplier(ScalarMultiplier): super().__init__(short_circuit=short_circuit, add=add, dbl=dbl, scl=scl) self.always = always + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, RTLMultiplier): return False @@ -326,6 +335,9 @@ class CoronMultiplier(ScalarMultiplier): ): super().__init__(short_circuit=short_circuit, add=add, dbl=dbl, scl=scl) + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, CoronMultiplier): return False @@ -370,6 +382,9 @@ class LadderMultiplier(ScalarMultiplier): if (not complete or short_circuit) and dbl is None: raise ValueError + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, LadderMultiplier): return False @@ -419,6 +434,9 @@ class SimpleLadderMultiplier(ScalarMultiplier): super().__init__(short_circuit=short_circuit, add=add, dbl=dbl, scl=scl) self.complete = complete + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, SimpleLadderMultiplier): return False @@ -467,6 +485,9 @@ class DifferentialLadderMultiplier(ScalarMultiplier): super().__init__(short_circuit=short_circuit, dadd=dadd, dbl=dbl, scl=scl) self.complete = complete + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, DifferentialLadderMultiplier): return False @@ -517,6 +538,9 @@ class BinaryNAFMultiplier(ScalarMultiplier): short_circuit=short_circuit, add=add, dbl=dbl, neg=neg, scl=scl ) + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, BinaryNAFMultiplier): return False @@ -573,6 +597,9 @@ class WindowNAFMultiplier(ScalarMultiplier): self.width = width self.precompute_negation = precompute_negation + def __hash__(self): + return id(self) + def __eq__(self, other): if not isinstance(other, WindowNAFMultiplier): return False |
