Loading scared/container.py +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ class Container: def __str__(self): template_str = f'''Traces container: Number of traces: {len(self._ths)} Traces size : {self._ths.samples.shape[1]} Traces size : {len(self._ths.samples[0])} Metadata : {list(self._ths.metadatas.keys())} Frame : {self._frame_str} Preprocesses : {[p.__name__ for p in self.preprocesses] if len(self.preprocesses) > 0 else 'None'} Loading scared/distinguishers/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ class DistinguisherMixin(abc.ABC): logger.debug(f'Needed memory estimated to {needed_mem} GB, for available {available_mem}.') self._is_checked = True if needed_mem > 0.9 * available_mem: raise MemoryError( raise DistinguisherError( f'This analysis will probably need more than 90% of your available memory - {available_mem} GB available against {needed_mem} GB needed.' ) Loading scared/distinguishers/cpa.py +2 −3 Original line number Diff line number Diff line from .base import _StandaloneDistinguisher, DistinguisherMixin, DistinguisherError import numpy as _np import logging logger = logging.getLogger(__name__) Loading @@ -26,8 +25,8 @@ class CPADistinguisherMixin(DistinguisherMixin): self.ey = _np.zeros((data_words), dtype=self.precision) self.ey2 = _np.zeros((data_words), dtype=self.precision) self.exy = _np.zeros((data_words, trace_size), dtype=self.precision) except (ValueError, MemoryError) as e: raise type(e)(f'Trace size and data words are too large to proceed with accumulation for CPA {e}.') except ValueError as e: raise ValueError(f'Trace size and data words are too large to proceed with accumulation for CPA: {e}') def _update(self, traces, data): if traces.shape[1] != self.ex.shape[0]: Loading scared/distinguishers/dpa.py +4 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,10 @@ class DPADistinguisherMixin(DistinguisherMixin): self.accumulator_traces = _np.zeros((trace_size), dtype=self.precision) self.accumulator_ones = _np.zeros((data_words, trace_size), dtype=self.precision) self.processed_ones = _np.zeros((data_words), dtype='uint32') except (ValueError, MemoryError) as e: raise type(e)(f'Trace size and data words are too large to proceed with accumulation for DPA {e}') except ValueError as e: raise ValueError(f'Trace size and data words are too large to proceed with accumulation for DPA: {e}.') except MemoryError as e: raise MemoryError(f'Trace size and data words results in too large intermediate state to proceed with accumulation for DPA as {e}.') def _update(self, traces, data): if traces.shape[1] != self.accumulator_traces.shape[0]: Loading scared/distinguishers/partitioned.py +1 −4 Original line number Diff line number Diff line Loading @@ -22,10 +22,7 @@ class _PartitionnedDistinguisherBaseMixin(DistinguisherMixin): self.partitions = range(r) self._trace_length = traces.shape[1] self._data_words = data.shape[1] try: self._initialize_accumulators() except MemoryError: raise MemoryError(f'Trace size and data words are too large to proceed with accumulation.') def _update(self, traces, data): if traces.shape[1] != self._trace_length: Loading Loading
scared/container.py +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ class Container: def __str__(self): template_str = f'''Traces container: Number of traces: {len(self._ths)} Traces size : {self._ths.samples.shape[1]} Traces size : {len(self._ths.samples[0])} Metadata : {list(self._ths.metadatas.keys())} Frame : {self._frame_str} Preprocesses : {[p.__name__ for p in self.preprocesses] if len(self.preprocesses) > 0 else 'None'} Loading
scared/distinguishers/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ class DistinguisherMixin(abc.ABC): logger.debug(f'Needed memory estimated to {needed_mem} GB, for available {available_mem}.') self._is_checked = True if needed_mem > 0.9 * available_mem: raise MemoryError( raise DistinguisherError( f'This analysis will probably need more than 90% of your available memory - {available_mem} GB available against {needed_mem} GB needed.' ) Loading
scared/distinguishers/cpa.py +2 −3 Original line number Diff line number Diff line from .base import _StandaloneDistinguisher, DistinguisherMixin, DistinguisherError import numpy as _np import logging logger = logging.getLogger(__name__) Loading @@ -26,8 +25,8 @@ class CPADistinguisherMixin(DistinguisherMixin): self.ey = _np.zeros((data_words), dtype=self.precision) self.ey2 = _np.zeros((data_words), dtype=self.precision) self.exy = _np.zeros((data_words, trace_size), dtype=self.precision) except (ValueError, MemoryError) as e: raise type(e)(f'Trace size and data words are too large to proceed with accumulation for CPA {e}.') except ValueError as e: raise ValueError(f'Trace size and data words are too large to proceed with accumulation for CPA: {e}') def _update(self, traces, data): if traces.shape[1] != self.ex.shape[0]: Loading
scared/distinguishers/dpa.py +4 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,10 @@ class DPADistinguisherMixin(DistinguisherMixin): self.accumulator_traces = _np.zeros((trace_size), dtype=self.precision) self.accumulator_ones = _np.zeros((data_words, trace_size), dtype=self.precision) self.processed_ones = _np.zeros((data_words), dtype='uint32') except (ValueError, MemoryError) as e: raise type(e)(f'Trace size and data words are too large to proceed with accumulation for DPA {e}') except ValueError as e: raise ValueError(f'Trace size and data words are too large to proceed with accumulation for DPA: {e}.') except MemoryError as e: raise MemoryError(f'Trace size and data words results in too large intermediate state to proceed with accumulation for DPA as {e}.') def _update(self, traces, data): if traces.shape[1] != self.accumulator_traces.shape[0]: Loading
scared/distinguishers/partitioned.py +1 −4 Original line number Diff line number Diff line Loading @@ -22,10 +22,7 @@ class _PartitionnedDistinguisherBaseMixin(DistinguisherMixin): self.partitions = range(r) self._trace_length = traces.shape[1] self._data_words = data.shape[1] try: self._initialize_accumulators() except MemoryError: raise MemoryError(f'Trace size and data words are too large to proceed with accumulation.') def _update(self, traces, data): if traces.shape[1] != self._trace_length: Loading