aboutsummaryrefslogtreecommitdiff
path: root/test/ec/test_transformations.py
blob: 2f2383cda3213ef658ec6a58f266419a8787e29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))