@@ -61,13 +61,13 @@ class CurveFp(object):
6161
6262 def __init__ (self , p , a , b , h = None ):
6363 """
64- The curve of points satisfying y^2 = x^3 + a*x + b (mod p).
64+ The curve of points satisfying y^2 = x^3 + a*x + b (mod p).
6565
66- h is an integer that is the cofactor of the elliptic curve domain
67- parameters; it is the number of points satisfying the elliptic curve
68- equation divided by the order of the base point. It is used for selection
69- of efficient algorithm for public point verification.
70- """
66+ h is an integer that is the cofactor of the elliptic curve domain
67+ parameters; it is the number of points satisfying the elliptic curve
68+ equation divided by the order of the base point. It is used for selection
69+ of efficient algorithm for public point verification.
70+ """
7171 self .__p = mpz (p )
7272 self .__a = mpz (a )
7373 self .__b = mpz (b )
@@ -79,13 +79,13 @@ def __init__(self, p, a, b, h=None):
7979
8080 def __init__ (self , p , a , b , h = None ):
8181 """
82- The curve of points satisfying y^2 = x^3 + a*x + b (mod p).
82+ The curve of points satisfying y^2 = x^3 + a*x + b (mod p).
8383
84- h is an integer that is the cofactor of the elliptic curve domain
85- parameters; it is the number of points satisfying the elliptic curve
86- equation divided by the order of the base point. It is used for selection
87- of efficient algorithm for public point verification.
88- """
84+ h is an integer that is the cofactor of the elliptic curve domain
85+ parameters; it is the number of points satisfying the elliptic curve
86+ equation divided by the order of the base point. It is used for selection
87+ of efficient algorithm for public point verification.
88+ """
8989 self .__p = p
9090 self .__a = a
9191 self .__b = b
@@ -131,32 +131,32 @@ def __str__(self):
131131
132132class PointJacobi (object ):
133133 """
134- Point on an elliptic curve. Uses Jacobi coordinates.
134+ Point on an elliptic curve. Uses Jacobi coordinates.
135135
136- In Jacobian coordinates, there are three parameters, X, Y and Z.
137- They correspond to affine parameters 'x' and 'y' like so:
136+ In Jacobian coordinates, there are three parameters, X, Y and Z.
137+ They correspond to affine parameters 'x' and 'y' like so:
138138
139- x = X / Z²
140- y = Y / Z³
141- """
139+ x = X / Z²
140+ y = Y / Z³
141+ """
142142
143143 def __init__ (self , curve , x , y , z , order = None , generator = False ):
144144 """
145- Initialise a point that uses Jacobi representation internally.
146-
147- :param CurveFp curve: curve on which the point resides
148- :param int x: the X parameter of Jacobi representation (equal to x when
149- converting from affine coordinates
150- :param int y: the Y parameter of Jacobi representation (equal to y when
151- converting from affine coordinates
152- :param int z: the Z parameter of Jacobi representation (equal to 1 when
153- converting from affine coordinates
154- :param int order: the point order, must be non zero when using
155- generator=True
156- :param bool generator: the point provided is a curve generator, as
157- such, it will be commonly used with scalar multiplication. This will
158- cause to precompute multiplication table for it
159- """
145+ Initialise a point that uses Jacobi representation internally.
146+
147+ :param CurveFp curve: curve on which the point resides
148+ :param int x: the X parameter of Jacobi representation (equal to x when
149+ converting from affine coordinates
150+ :param int y: the Y parameter of Jacobi representation (equal to y when
151+ converting from affine coordinates
152+ :param int z: the Z parameter of Jacobi representation (equal to 1 when
153+ converting from affine coordinates
154+ :param int order: the point order, must be non zero when using
155+ generator=True
156+ :param bool generator: the point provided is a curve generator, as
157+ such, it will be commonly used with scalar multiplication. This will
158+ cause to precompute multiplication table for it
159+ """
160160 self .__curve = curve
161161 # since it's generally better (faster) to use scaled points vs unscaled
162162 # ones, use writer-biased RWLock for locking:
@@ -220,8 +220,8 @@ def __eq__(self, other):
220220 def order (self ):
221221 """Return the order of the point.
222222
223- None if it is undefined.
224- """
223+ None if it is undefined.
224+ """
225225 return self .__order
226226
227227 def curve (self ):
@@ -230,13 +230,13 @@ def curve(self):
230230
231231 def x (self ):
232232 """
233- Return affine x coordinate.
233+ Return affine x coordinate.
234234
235- This method should be used only when the 'y' coordinate is not needed.
236- It's computationally more efficient to use `to_affine()` and then
237- call x() and y() on the returned instance. Or call `scale()`
238- and then x() and y() on the returned instance.
239- """
235+ This method should be used only when the 'y' coordinate is not needed.
236+ It's computationally more efficient to use `to_affine()` and then
237+ call x() and y() on the returned instance. Or call `scale()`
238+ and then x() and y() on the returned instance.
239+ """
240240 try :
241241 self ._scale_lock .reader_acquire ()
242242 if self .__z == 1 :
@@ -251,13 +251,13 @@ def x(self):
251251
252252 def y (self ):
253253 """
254- Return affine y coordinate.
254+ Return affine y coordinate.
255255
256- This method should be used only when the 'x' coordinate is not needed.
257- It's computationally more efficient to use `to_affine()` and then
258- call x() and y() on the returned instance. Or call `scale()`
259- and then x() and y() on the returned instance.
260- """
256+ This method should be used only when the 'x' coordinate is not needed.
257+ It's computationally more efficient to use `to_affine()` and then
258+ call x() and y() on the returned instance. Or call `scale()`
259+ and then x() and y() on the returned instance.
260+ """
261261 try :
262262 self ._scale_lock .reader_acquire ()
263263 if self .__z == 1 :
@@ -272,10 +272,10 @@ def y(self):
272272
273273 def scale (self ):
274274 """
275- Return point scaled so that z == 1.
275+ Return point scaled so that z == 1.
276276
277- Modifies point in place, returns self.
278- """
277+ Modifies point in place, returns self.
278+ """
279279 try :
280280 self ._scale_lock .reader_acquire ()
281281 if self .__z == 1 :
@@ -312,10 +312,10 @@ def to_affine(self):
312312 def from_affine (point , generator = False ):
313313 """Create from an affine point.
314314
315- :param bool generator: set to True to make the point to precalculate
316- multiplication table - useful for public point when verifying many
317- signatures (around 100 or so) or for generator points of a curve.
318- """
315+ :param bool generator: set to True to make the point to precalculate
316+ multiplication table - useful for public point when verifying many
317+ signatures (around 100 or so) or for generator points of a curve.
318+ """
319319 return PointJacobi (
320320 point .curve (), point .x (), point .y (), 1 , point .order (), generator
321321 )
0 commit comments