@@ -139,10 +139,10 @@ def __init__(self, generator, point, verify=True):
139
139
raise InvalidPointError ("Generator point order is bad." )
140
140
141
141
def __eq__ (self , other ):
142
- if isinstance (other , Public_key ):
142
+ if isinstance (other , Public_key ):
143
143
"""Return True if the points are identical, False otherwise."""
144
144
return self .curve == other .curve \
145
- and self .point == other .point
145
+ and self .point == other .point
146
146
return NotImplemented
147
147
148
148
def verifies (self , hash , signature ):
@@ -182,12 +182,12 @@ def __init__(self, public_key, secret_multiplier):
182
182
183
183
self .public_key = public_key
184
184
self .secret_multiplier = secret_multiplier
185
-
185
+
186
186
def __eq__ (self , other ):
187
- if isinstance (other , Private_key ):
187
+ if isinstance (other , Private_key ):
188
188
"""Return True if the points are identical, False otherwise."""
189
189
return self .public_key == other .public_key \
190
- and self .secret_multiplier == other .secret_multiplier
190
+ and self .secret_multiplier == other .secret_multiplier
191
191
return NotImplemented
192
192
193
193
def sign (self , hash , random_k ):
@@ -220,8 +220,8 @@ def sign(self, hash, random_k):
220
220
r = p1 .x () % n
221
221
if r == 0 :
222
222
raise RSZeroError ("amazingly unlucky random number r" )
223
- s = (numbertheory .inverse_mod (k , n ) *
224
- (hash + (self .secret_multiplier * r ) % n )) % n
223
+ s = (numbertheory .inverse_mod (k , n )
224
+ * (hash + (self .secret_multiplier * r ) % n )) % n
225
225
if s == 0 :
226
226
raise RSZeroError ("amazingly unlucky random number s" )
227
227
return Signature (r , s )
@@ -277,8 +277,8 @@ def point_is_valid(generator, x, y):
277
277
if not curve .contains_point (x , y ):
278
278
return False
279
279
if curve .cofactor () != 1 and \
280
- not n * ellipticcurve .PointJacobi (curve , x , y , 1 )\
281
- == ellipticcurve .INFINITY :
280
+ not n * ellipticcurve .PointJacobi (curve , x , y , 1 )\
281
+ == ellipticcurve .INFINITY :
282
282
return False
283
283
return True
284
284
@@ -361,7 +361,7 @@ def point_is_valid(generator, x, y):
361
361
generator_secp256k1 = ellipticcurve .PointJacobi (
362
362
curve_secp256k1 , _Gx , _Gy , 1 , _r , generator = True )
363
363
364
- # Brainpool P-160-r1
364
+ # Brainpool P-160-r1
365
365
_a = 0x340E7BE2A280EB74E2BE61BADA745D97E8F7C300
366
366
_b = 0x1E589A8595423412134FAA2DBDEC95C8D8675E58
367
367
_p = 0xE95E4A5F737059DC60DFC7AD95B3D8139515620F
0 commit comments