From 2aa191c63c556857ee22e801c19ee9822016f7cc Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 1 Jul 2020 23:08:43 +0200 Subject: Add random generation of points, speedup computation. --- test/ec/test_context.py | 2 -- test/ec/test_curve.py | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ec/test_context.py b/test/ec/test_context.py index c3112d4..603369d 100644 --- a/test/ec/test_context.py +++ b/test/ec/test_context.py @@ -86,8 +86,6 @@ class ContextTests(TestCase): with local(PathContext([0, 1, 7])) as ctx: key_generator = KeyGeneration(self.mult, self.secp128r1, True) key_generator.generate() - print(ctx.value) - def test_str(self): with local(DefaultContext()) as default: diff --git a/test/ec/test_curve.py b/test/ec/test_curve.py index f9e3387..a480bb0 100644 --- a/test/ec/test_curve.py +++ b/test/ec/test_curve.py @@ -70,6 +70,13 @@ class CurveTests(TestCase): self.assertIsNone(self.curve25519.curve.affine_neutral) self.assertIsNotNone(self.ed25519.curve.affine_neutral) + def test_affine_random(self): + for params in [self.secp128r1, self.curve25519, self.ed25519]: + for _ in range(20): + pt = params.curve.affine_random() + self.assertIsNotNone(pt) + self.assertTrue(params.curve.is_on_curve(pt)) + def test_neutral_is_affine(self): self.assertFalse(self.secp128r1.curve.neutral_is_affine) self.assertFalse(self.curve25519.curve.neutral_is_affine) -- cgit v1.2.3-70-g09d2