aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJ08nY2020-07-01 23:08:43 +0200
committerJ08nY2020-07-01 23:09:30 +0200
commit2aa191c63c556857ee22e801c19ee9822016f7cc (patch)
tree8824b678714c71979c4f8579c9cf782a6fadcc5e /test
parent3eaaed8ff2dfa36ad31884bc4cb0f45e0bf8f427 (diff)
downloadpyecsca-2aa191c63c556857ee22e801c19ee9822016f7cc.tar.gz
pyecsca-2aa191c63c556857ee22e801c19ee9822016f7cc.tar.zst
pyecsca-2aa191c63c556857ee22e801c19ee9822016f7cc.zip
Add random generation of points, speedup computation.
Diffstat (limited to 'test')
-rw-r--r--test/ec/test_context.py2
-rw-r--r--test/ec/test_curve.py7
2 files changed, 7 insertions, 2 deletions
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)