| 407 | ]; |
| 408 | |
| 409 | fn verify_blake_output_with_limbs(message: &[u8], expected_hash: [u8; 32], limb_lens: &[u8]) { |
| 410 | for limb_len in limb_lens.iter().copied() { |
| 411 | let mut bytes = blake3_push_message_script_with_limb(message, limb_len) |
| 412 | .compile() |
| 413 | .to_bytes(); |
| 414 | let optimized = optimizer::optimize( |
| 415 | blake3_compute_script_with_limb(message.len(), limb_len).compile(), |
| 416 | ); |
| 417 | bytes.extend(optimized.to_bytes()); |
| 418 | bytes.extend( |
| 419 | blake3_verify_output_script(expected_hash) |
| 420 | .compile() |
| 421 | .to_bytes(), |
| 422 | ); |
| 423 | let script = ScriptBuf::from_bytes(bytes); |
| 424 | assert!(execute_script_buf_without_stack_limit(script).success); |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | fn verify_blake_outputs_cached_with_limbs<const LEN: usize>( |
| 429 | messages: &[[u8; LEN]], |