aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/mod.py
diff options
context:
space:
mode:
authorJ08nY2019-04-24 19:26:11 +0200
committerJ08nY2019-04-24 19:26:11 +0200
commit2a109ad4502bc7983c9fd4fc29a62b6f028762b0 (patch)
treeab0074015d3e2008fa0071efbfb49f2c224e78c7 /pyecsca/ec/mod.py
parentf4bcb085cfc9ddac71fe8bb82e8f6719309b2637 (diff)
downloadpyecsca-2a109ad4502bc7983c9fd4fc29a62b6f028762b0.tar.gz
pyecsca-2a109ad4502bc7983c9fd4fc29a62b6f028762b0.tar.zst
pyecsca-2a109ad4502bc7983c9fd4fc29a62b6f028762b0.zip
Diffstat (limited to 'pyecsca/ec/mod.py')
-rw-r--r--pyecsca/ec/mod.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pyecsca/ec/mod.py b/pyecsca/ec/mod.py
index e9c5657..dd09847 100644
--- a/pyecsca/ec/mod.py
+++ b/pyecsca/ec/mod.py
@@ -1,9 +1,11 @@
from functools import wraps
+
from public import public
@public
def gcd(a, b):
+ """Euclid's greatest common denominator algorithm."""
if abs(a) < abs(b):
return gcd(b, a)
@@ -16,6 +18,7 @@ def gcd(a, b):
@public
def extgcd(a, b):
+ """Extended Euclid's greatest common denominator algorithm."""
if abs(b) > abs(a):
(x, y, d) = extgcd(b, a)
return y, x, d
@@ -48,6 +51,7 @@ def check(func):
@public
class Mod(object):
+ """An element x of ℤₙ."""
def __init__(self, x: int, n: int):
self.x: int = x % n
@@ -150,7 +154,7 @@ class Mod(object):
class Undefined(Mod):
def __init__(self):
- pass
+ object.__init__(self)
def __add__(self, other):
raise NotImplementedError