@@ -36,7 +36,7 @@ def check_wrong_message(alg_name):
36
36
message = bytes (random .getrandbits (8 ) for _ in range (100 ))
37
37
public_key = sig .generate_keypair ()
38
38
signature = sig .sign (message )
39
- wrong_message = bytes (random .getrandbits (8 ) for _ in range (100 ))
39
+ wrong_message = bytes (random .getrandbits (8 ) for _ in range (len ( message ) ))
40
40
assert not (sig .verify (wrong_message , signature , public_key ))
41
41
42
42
@@ -52,7 +52,7 @@ def check_wrong_signature(alg_name):
52
52
message = bytes (random .getrandbits (8 ) for _ in range (100 ))
53
53
public_key = sig .generate_keypair ()
54
54
signature = sig .sign (message )
55
- wrong_signature = bytes (random .getrandbits (8 ) for _ in range (sig . details [ 'length_signature' ] ))
55
+ wrong_signature = bytes (random .getrandbits (8 ) for _ in range (len ( signature ) ))
56
56
assert not (sig .verify (message , wrong_signature , public_key ))
57
57
58
58
@@ -68,7 +68,7 @@ def check_wrong_public_key(alg_name):
68
68
message = bytes (random .getrandbits (8 ) for _ in range (100 ))
69
69
public_key = sig .generate_keypair ()
70
70
signature = sig .sign (message )
71
- wrong_public_key = bytes (random .getrandbits (8 ) for _ in range (sig . details [ 'length_public_key' ] ))
71
+ wrong_public_key = bytes (random .getrandbits (8 ) for _ in range (len ( public_key ) ))
72
72
assert not (sig .verify (message , signature , wrong_public_key ))
73
73
74
74
0 commit comments