aboutsummaryrefslogtreecommitdiff
path: root/test/ec/test_transformations.py
diff options
context:
space:
mode:
authorJ08nY2020-03-16 20:44:22 +0100
committerJ08nY2020-03-16 20:44:22 +0100
commitc2b75500aa3dbcb0d2367439e29d33440bf77688 (patch)
treeb91c1b3fe8efb085aed14e51600fa88a35b15772 /test/ec/test_transformations.py
parent9d4d881d6d847b044959b3c080dac1c9488445e8 (diff)
downloadpyecsca-c2b75500aa3dbcb0d2367439e29d33440bf77688.tar.gz
pyecsca-c2b75500aa3dbcb0d2367439e29d33440bf77688.tar.bz2
pyecsca-c2b75500aa3dbcb0d2367439e29d33440bf77688.zip
Add curve transformations M2SW and M2TE.
Diffstat (limited to 'test/ec/test_transformations.py')
-rw-r--r--test/ec/test_transformations.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ec/test_transformations.py b/test/ec/test_transformations.py
new file mode 100644
index 0000000..2f2383c
--- /dev/null
+++ b/test/ec/test_transformations.py
@@ -0,0 +1,18 @@
+from unittest import TestCase
+
+from pyecsca.ec.params import get_params
+from pyecsca.ec.transformations import M2SW, M2TE
+
+
+class TransformationTests(TestCase):
+
+ def test_montgomery(self):
+ curve25519 = get_params("other", "Curve25519", "affine")
+ sw = M2SW(curve25519)
+ self.assertIsNotNone(sw)
+ self.assertTrue(sw.curve.is_on_curve(sw.generator))
+ self.assertTrue(sw.curve.is_neutral(sw.curve.neutral))
+ te = M2TE(curve25519)
+ self.assertIsNotNone(te)
+ self.assertTrue(te.curve.is_on_curve(te.generator))
+ self.assertTrue(te.curve.is_neutral(te.curve.neutral))