From 682bd9121a2dad23cadd31d92f295670e856e6e0 Mon Sep 17 00:00:00 2001 From: J08nY Date: Tue, 29 Jul 2025 17:52:46 +0200 Subject: Improve memory and pickle space usage of FakePoint. --- pyecsca/ec/formula/fake.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pyecsca/ec/formula/fake.py b/pyecsca/ec/formula/fake.py index d9e8545..c85f607 100644 --- a/pyecsca/ec/formula/fake.py +++ b/pyecsca/ec/formula/fake.py @@ -89,9 +89,15 @@ class FakePoint(Point): """Just a fake point.""" def __init__(self, model): # noqa: We initialize everything here - self.coords = _fake_coords(model) self.coordinate_model = model - self.field = 0 + + @property + def field(self): + return 0 + + @property + def coords(self): + return _fake_coords(self.coordinate_model) def __str__(self): return f"FakePoint{id(self)}" @@ -110,3 +116,9 @@ class FakePoint(Point): def __deepcopy__(self, memo): return self + + def __getstate__(self): + return {"model": self.coordinate_model} + + def __setstate__(self, state): + self.coordinate_model = state["model"] -- cgit v1.2.3-70-g09d2