2424 privkey = Private_key( pubkey, secret )
2525
2626 # Signing a hash value:
27-
27+
2828 hash = randrange( 1, n )
2929 signature = privkey.sign( hash, randrange( 1, n ) )
3030
@@ -77,7 +77,7 @@ def __init__( self, generator, point ):
7777 """generator is the Point that generates the group,
7878 point is the Point that defines the public key.
7979 """
80-
80+
8181 self .curve = generator .curve ()
8282 self .generator = generator
8383 self .point = point
@@ -109,7 +109,7 @@ def verifies( self, hash, signature ):
109109 xy = u1 * G + u2 * self .point
110110 v = xy .x () % n
111111 return v == r
112-
112+
113113
114114
115115class Private_key ( object ):
@@ -120,7 +120,7 @@ def __init__( self, public_key, secret_multiplier ):
120120 """public_key is of class Public_key;
121121 secret_multiplier is a large integer.
122122 """
123-
123+
124124 self .public_key = public_key
125125 self .secret_multiplier = secret_multiplier
126126
@@ -396,31 +396,31 @@ def test_signature_validity( Msg, Qx, Qy, R, S, expected ):
396396 0x6a223d00bd22c52833409a163e057e5b5da1def2a197dd15 , \
397397 0x7b482604199367f1f303f9ef627f922f97023e90eae08abf , \
398398 True )
399-
399+
400400 test_point_validity (
401401 p192 , \
402402 0x6dccbde75c0948c98dab32ea0bc59fe125cf0fb1a3798eda , \
403403 0x0001171a3e0fa60cf3096f4e116b556198de430e1fbd330c8835 , \
404404 False )
405-
405+
406406 test_point_validity (
407407 p192 , \
408408 0xd266b39e1f491fc4acbbbc7d098430931cfa66d55015af12 , \
409409 0x193782eb909e391a3148b7764e6b234aa94e48d30a16dbb2 , \
410410 False )
411-
411+
412412 test_point_validity (
413413 p192 , \
414414 0x9d6ddbcd439baa0c6b80a654091680e462a7d1d3f1ffeb43 , \
415415 0x6ad8efc4d133ccf167c44eb4691c80abffb9f82b932b8caa , \
416416 False )
417-
417+
418418 test_point_validity (
419419 p192 , \
420420 0x146479d944e6bda87e5b35818aa666a4c998a71f4e95edbc , \
421421 0xa86d6fe62bc8fbd88139693f842635f687f132255858e7f6 , \
422422 False )
423-
423+
424424 test_point_validity (
425425 p192 , \
426426 0xe594d4a598046f3598243f50fd2c7bd7d380edb055802253 , \
@@ -550,18 +550,18 @@ def test_signature_validity( Msg, Qx, Qy, R, S, expected ):
550550 # further precautions are appropriate.)
551551
552552 randrange = random .SystemRandom ().randrange
553-
553+
554554 secret = randrange ( 1 , n )
555555 pubkey = Public_key ( g , g * secret )
556556 privkey = Private_key ( pubkey , secret )
557557
558558 # Signing a hash value:
559-
559+
560560 hash = randrange ( 1 , n )
561561 signature = privkey .sign ( hash , randrange ( 1 , n ) )
562562
563563 # Verifying a signature for a hash value:
564-
564+
565565 if pubkey .verifies ( hash , signature ):
566566 print_ ("Demo verification succeeded." )
567567 else :
0 commit comments