Returns a script that verifies the BLAKE3 output on the stack. The script pops the BLAKE3 output and compares it with the given, expected output.
(expected_output: [u8; 32])
| 367 | /// |
| 368 | /// The script pops the BLAKE3 output and compares it with the given, expected output. |
| 369 | pub fn blake3_verify_output_script(expected_output: [u8; 32]) -> Script { |
| 370 | script! { |
| 371 | for (i, byte) in expected_output.into_iter().enumerate() { |
| 372 | {byte} |
| 373 | if i % 32 == 31 { |
| 374 | {U256::transform_limbsize(8,4)} |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | for i in (2..65).rev() { |
| 379 | {i} |
| 380 | OP_ROLL |
| 381 | OP_EQUALVERIFY |
| 382 | } |
| 383 | OP_EQUAL |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | #[cfg(test)] |
| 388 | mod tests { |
no outgoing calls
no test coverage detected