aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/group.py
blob: af0dae2d6d040a2e7d6afff3d3bf3f77d478b942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from public import public

from .curve import EllipticCurve
from .point import Point


@public
class AbelianGroup(object):
    curve: EllipticCurve
    generator: Point
    neutral: Point
    order: int
    cofactor: int

    def __init__(self, curve: EllipticCurve, generator: Point, neutral: Point, order: int,
                 cofactor: int):
        self.curve = curve
        self.generator = generator
        self.neutral = neutral
        self.order = order
        self.cofactor = cofactor

    def is_neutral(self, point: Point) -> bool:
        return self.neutral == point