diff options
| author | J08nY | 2024-04-04 11:15:24 +0200 |
|---|---|---|
| committer | J08nY | 2024-04-04 11:16:11 +0200 |
| commit | 010a328a553d92dead6ee8a93498b876d7ba953f (patch) | |
| tree | 7847ba416830f789403a1cc47abc1f0bda0250e3 /pyecsca/ec/mult | |
| parent | 379e8634459ee27af4bd5ef22d0f36abc3db387a (diff) | |
| download | pyecsca-010a328a553d92dead6ee8a93498b876d7ba953f.tar.gz pyecsca-010a328a553d92dead6ee8a93498b876d7ba953f.tar.zst pyecsca-010a328a553d92dead6ee8a93498b876d7ba953f.zip | |
Diffstat (limited to 'pyecsca/ec/mult')
| -rw-r--r-- | pyecsca/ec/mult/base.py | 2 | ||||
| -rw-r--r-- | pyecsca/ec/mult/binary.py | 4 | ||||
| -rw-r--r-- | pyecsca/ec/mult/comb.py | 4 | ||||
| -rw-r--r-- | pyecsca/ec/mult/fixed.py | 2 | ||||
| -rw-r--r-- | pyecsca/ec/mult/ladder.py | 6 | ||||
| -rw-r--r-- | pyecsca/ec/mult/naf.py | 4 | ||||
| -rw-r--r-- | pyecsca/ec/mult/window.py | 6 |
7 files changed, 14 insertions, 14 deletions
diff --git a/pyecsca/ec/mult/base.py b/pyecsca/ec/mult/base.py index 71ddc44..0c244c6 100644 --- a/pyecsca/ec/mult/base.py +++ b/pyecsca/ec/mult/base.py @@ -181,7 +181,7 @@ class ScalarMultiplier(ABC): )[0] def __hash__(self): - return id(self) + return hash((ScalarMultiplier, tuple(self.formulas.keys()), tuple(self.formulas.values()), self.short_circuit)) def __eq__(self, other): if not isinstance(other, ScalarMultiplier): diff --git a/pyecsca/ec/mult/binary.py b/pyecsca/ec/mult/binary.py index 6a8d717..89c203c 100644 --- a/pyecsca/ec/mult/binary.py +++ b/pyecsca/ec/mult/binary.py @@ -56,7 +56,7 @@ class DoubleAndAddMultiplier(AccumulatorMultiplier, ScalarMultiplier, ABC): self.complete = complete def __hash__(self): - return id(self) + return hash((DoubleAndAddMultiplier, super().__hash__(), self.direction, self.accumulation_order, self.always, self.complete)) def __eq__(self, other): if not isinstance(other, DoubleAndAddMultiplier): @@ -195,7 +195,7 @@ class CoronMultiplier(ScalarMultiplier): super().__init__(short_circuit=short_circuit, add=add, dbl=dbl, scl=scl) def __hash__(self): - return id(self) + return hash((CoronMultiplier, super().__hash__())) def __eq__(self, other): if not isinstance(other, CoronMultiplier): diff --git a/pyecsca/ec/mult/comb.py b/pyecsca/ec/mult/comb.py index 860dab7..c65adb6 100644 --- a/pyecsca/ec/mult/comb.py +++ b/pyecsca/ec/mult/comb.py @@ -61,7 +61,7 @@ class BGMWMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.width = width def __hash__(self): - return id(self) + return hash((BGMWMultiplier, super().__hash__(), self.width, self.direction, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, BGMWMultiplier): @@ -147,7 +147,7 @@ class CombMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.width = width def __hash__(self): - return id(self) + return hash((CombMultiplier, super().__hash__(), self.width, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, CombMultiplier): diff --git a/pyecsca/ec/mult/fixed.py b/pyecsca/ec/mult/fixed.py index da14e5f..fedc22d 100644 --- a/pyecsca/ec/mult/fixed.py +++ b/pyecsca/ec/mult/fixed.py @@ -55,7 +55,7 @@ class FullPrecompMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.complete = complete def __hash__(self): - return id(self) + return hash((FullPrecompMultiplier, super().__hash__(), self.direction, self.accumulation_order, self.always)) def __eq__(self, other): if not isinstance(other, FullPrecompMultiplier): diff --git a/pyecsca/ec/mult/ladder.py b/pyecsca/ec/mult/ladder.py index b950899..2f7fd26 100644 --- a/pyecsca/ec/mult/ladder.py +++ b/pyecsca/ec/mult/ladder.py @@ -45,7 +45,7 @@ class LadderMultiplier(ScalarMultiplier): raise ValueError def __hash__(self): - return id(self) + return hash((LadderMultiplier, super().__hash__(), self.complete)) def __eq__(self, other): if not isinstance(other, LadderMultiplier): @@ -107,7 +107,7 @@ class SimpleLadderMultiplier(ScalarMultiplier): self.complete = complete def __hash__(self): - return id(self) + return hash((SimpleLadderMultiplier, super().__hash__(), self.complete)) def __eq__(self, other): if not isinstance(other, SimpleLadderMultiplier): @@ -168,7 +168,7 @@ class DifferentialLadderMultiplier(ScalarMultiplier): self.complete = complete def __hash__(self): - return id(self) + return hash((DifferentialLadderMultiplier, super().__hash__(), self.complete)) def __eq__(self, other): if not isinstance(other, DifferentialLadderMultiplier): diff --git a/pyecsca/ec/mult/naf.py b/pyecsca/ec/mult/naf.py index 84019b5..b21d1cf 100644 --- a/pyecsca/ec/mult/naf.py +++ b/pyecsca/ec/mult/naf.py @@ -48,7 +48,7 @@ class BinaryNAFMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.direction = direction def __hash__(self): - return id(self) + return hash((BinaryNAFMultiplier, super().__hash__(), self.direction, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, BinaryNAFMultiplier): @@ -142,7 +142,7 @@ class WindowNAFMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.precompute_negation = precompute_negation def __hash__(self): - return id(self) + return hash((WindowNAFMultiplier, super().__hash__(), self.width, self.precompute_negation, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, WindowNAFMultiplier): diff --git a/pyecsca/ec/mult/window.py b/pyecsca/ec/mult/window.py index d025cc1..d4967e8 100644 --- a/pyecsca/ec/mult/window.py +++ b/pyecsca/ec/mult/window.py @@ -61,7 +61,7 @@ class SlidingWindowMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.recoding_direction = recoding_direction def __hash__(self): - return id(self) + return hash((SlidingWindowMultiplier, super().__hash__(), self.width, self.recoding_direction, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, SlidingWindowMultiplier): @@ -150,7 +150,7 @@ class FixedWindowLTRMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.m = m def __hash__(self): - return id(self) + return hash((FixedWindowLTRMultiplier, super().__hash__(), self.m, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, FixedWindowLTRMultiplier): @@ -252,7 +252,7 @@ class WindowBoothMultiplier(AccumulatorMultiplier, ScalarMultiplier): self.precompute_negation = precompute_negation def __hash__(self): - return id(self) + return hash((WindowBoothMultiplier, super().__hash__(), self.width, self.precompute_negation, self.accumulation_order)) def __eq__(self, other): if not isinstance(other, WindowBoothMultiplier): |
