X-Git-Url: http://www.git.cypherpunks.ru/?p=pygost.git;a=blobdiff_plain;f=pygost%2Fgost3410.py;h=96520cb48d7bce6919a19365d25d459d4288ef0f;hp=f4c0538476265e44194cb816cc8727b9ac2a4083;hb=2e336566fbe3a603b5565142f5112880035be7f1;hpb=dbf1356d72b65123cbce14f0e685c5f3cb06335c diff --git a/pygost/gost3410.py b/pygost/gost3410.py index f4c0538..96520cb 100644 --- a/pygost/gost3410.py +++ b/pygost/gost3410.py @@ -53,8 +53,9 @@ class GOST3410Curve(object): the canonical form :param long e, d: coefficients of the equation of the elliptic curve in the twisted Edwards form + :param str name: human-readable curve name """ - def __init__(self, p, q, a, b, x, y, cofactor=1, e=None, d=None): + def __init__(self, p, q, a, b, x, y, cofactor=1, e=None, d=None, name=None): self.p = p self.q = q self.a = a @@ -67,11 +68,15 @@ class GOST3410Curve(object): if not self.contains((x, y)): raise ValueError("Invalid parameters") self._st = None + self.name = name @property def point_size(self): return point_size(self.p) + def __repr__(self): + return "<%s: %s>" % (self.__class__.__name__, self.name) + def pos(self, v): """Make positive number """ @@ -231,6 +236,8 @@ CURVES["id-tc26-gost-3410-2012-512-paramSetTest"] = CURVES["id-tc26-gost-3410-12 CURVES["id-tc26-gost-3410-2012-512-paramSetA"] = CURVES["id-tc26-gost-3410-12-512-paramSetA"] CURVES["id-tc26-gost-3410-2012-512-paramSetB"] = CURVES["id-tc26-gost-3410-12-512-paramSetB"] CURVES["id-tc26-gost-3410-2012-512-paramSetC"] = CURVES["id-tc26-gost-3410-12-512-paramSetC"] +for name, curve in CURVES.items(): + curve.name = name DEFAULT_CURVE = CURVES["id-tc26-gost-3410-12-256-paramSetB"]