diff options
| author | J08nY | 2023-10-14 22:18:04 +0200 |
|---|---|---|
| committer | J08nY | 2023-10-14 22:18:04 +0200 |
| commit | 883e5b00dd6b52264d68da66d8b9268f227a8752 (patch) | |
| tree | 54cbaaccda18b129a0939c9f52bd2942374cad05 /test/ec/test_point.py | |
| parent | f1993d49f2ed28cacf5537410c0db99dc8bdeaeb (diff) | |
| download | pyecsca-883e5b00dd6b52264d68da66d8b9268f227a8752.tar.gz pyecsca-883e5b00dd6b52264d68da66d8b9268f227a8752.tar.zst pyecsca-883e5b00dd6b52264d68da66d8b9268f227a8752.zip | |
Make stuff picklable.
Fixes #45.
Diffstat (limited to '')
| -rw-r--r-- | test/ec/test_point.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ec/test_point.py b/test/ec/test_point.py index 7a0440c..9513840 100644 --- a/test/ec/test_point.py +++ b/test/ec/test_point.py @@ -1,3 +1,4 @@ +import pickle from contextlib import nullcontext as does_not_raise from pyecsca.ec.coordinates import AffineCoordinateModel from pyecsca.ec.params import get_params @@ -174,3 +175,14 @@ def test_iter(secp128r1, secp128r1_coords): assert len(InfinityPoint(secp128r1_coords)) == 0 assert len(tuple(InfinityPoint(secp128r1_coords))) == 0 + + +def test_pickle(secp128r1, secp128r1_coords): + pt = Point( + secp128r1_coords, + X=Mod(0x4, secp128r1.curve.prime), + Y=Mod(0x6, secp128r1.curve.prime), + Z=Mod(2, secp128r1.curve.prime), + ) + pickle.dumps(secp128r1_coords) + assert pt == pickle.loads(pickle.dumps(pt)) |
