aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/ec/group.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/ec/group.py')
-rw-r--r--pyecsca/ec/group.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pyecsca/ec/group.py b/pyecsca/ec/group.py
new file mode 100644
index 0000000..4c471cc
--- /dev/null
+++ b/pyecsca/ec/group.py
@@ -0,0 +1,26 @@
+from typing import Optional
+
+from public import public
+
+from .curve import EllipticCurve
+from .point import Point
+
+
+@public
+class AbelianGroup(object):
+ curve: EllipticCurve
+ generator: Point
+ neutral: Point
+ order: Optional[int]
+ cofactor: Optional[int]
+
+ def __init__(self, curve: EllipticCurve, generator: Point, neutral: Point, order: int = None,
+ cofactor: int = None):
+ 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