88 TEST_SIGNATURE_SCHEME ,
99 GeneralizedXmssScheme ,
1010)
11- from lean_spec .types import Uint64
11+ from lean_spec .types import Bytes32 , Uint64
1212
1313
1414def _test_correctness_roundtrip (
@@ -32,7 +32,7 @@ def _test_correctness_roundtrip(
3232 #
3333 # Pick a sample epoch within the active range to test signing.
3434 test_epoch = Uint64 (activation_epoch + num_active_epochs // 2 )
35- message = b"\x42 " * scheme . config . MESSAGE_LENGTH
35+ message = Bytes32 ( b"\x42 " * 32 )
3636
3737 # Sign the message at the chosen epoch.
3838 #
@@ -46,7 +46,7 @@ def _test_correctness_roundtrip(
4646 # TEST INVALID CASES
4747 #
4848 # Verification must fail if the message is tampered with.
49- tampered_message = b"\x43 " * scheme . config . MESSAGE_LENGTH
49+ tampered_message = Bytes32 ( b"\x43 " * 32 )
5050
5151 # With small test parameters (test configuration), there's a small chance that
5252 # the tampered message produces the same codeword as the original due to
@@ -176,7 +176,7 @@ def test_sign_requires_prepared_interval() -> None:
176176 assert int (outside_epoch ) not in prepared_interval
177177
178178 # Signing should fail
179- message = b"\x42 " * scheme . config . MESSAGE_LENGTH
179+ message = Bytes32 ( b"\x42 " * 32 )
180180 with pytest .raises (ValueError , match = "outside the prepared interval" ):
181181 scheme .sign (sk , outside_epoch , message )
182182
@@ -189,7 +189,7 @@ def test_deterministic_signing() -> None:
189189
190190 # Use epoch within prepared interval
191191 epoch = Uint64 (4 )
192- message = b"\x42 " * scheme . config . MESSAGE_LENGTH
192+ message = Bytes32 ( b"\x42 " * 32 )
193193
194194 # Sign twice
195195 sig1 = scheme .sign (sk , epoch , message )
@@ -218,7 +218,7 @@ def test_rejects_epoch_beyond_lifetime(self) -> None:
218218
219219 # Sign a valid message at a valid epoch.
220220 valid_epoch = Uint64 (4 )
221- message = b"\x42 " * scheme . config . MESSAGE_LENGTH
221+ message = Bytes32 ( b"\x42 " * 32 )
222222 signature = scheme .sign (sk , valid_epoch , message )
223223
224224 # Verify with an epoch beyond LIFETIME.
@@ -234,7 +234,7 @@ def test_rejects_very_large_epoch(self) -> None:
234234 pk , sk = scheme .key_gen (Uint64 (0 ), Uint64 (scheme .config .LIFETIME ))
235235
236236 valid_epoch = Uint64 (4 )
237- message = b"\x42 " * scheme . config . MESSAGE_LENGTH
237+ message = Bytes32 ( b"\x42 " * 32 )
238238 signature = scheme .sign (sk , valid_epoch , message )
239239
240240 # Try to verify with a huge epoch.
0 commit comments