diff options
Diffstat (limited to 'pyecsca/sca/trace/trace.py')
| -rw-r--r-- | pyecsca/sca/trace/trace.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pyecsca/sca/trace/trace.py b/pyecsca/sca/trace/trace.py index 0d5d027..367125b 100644 --- a/pyecsca/sca/trace/trace.py +++ b/pyecsca/sca/trace/trace.py @@ -1,4 +1,4 @@ -"""This module provides the Trace class.""" +"""Provides the Trace class.""" import weakref from typing import Any, Mapping, Sequence, Optional from copy import copy, deepcopy @@ -76,6 +76,10 @@ class Trace: return False return np.array_equal(self.samples, other.samples) and self.meta == other.meta + def __hash__(self): + # This will have collisions, but those can be sorted out by the equality check above. + return hash(str(self.samples)) + hash(self.meta) + def with_samples(self, samples: ndarray) -> "Trace": """ Construct a copy of this trace, with the same metadata, but samples replaced by `samples`. |
