INNER CODE UNIT · Rust
test_sha256_compress
ethereum/mpz · crates/circuits-data/src/lib.rs:126
fn test_sha256_compress() {
static SHA2_INITIAL_STATE: [u32; 8] = [
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab,
0x5be0cd19,
];
fn sha256_compress(msg: [u8; 64], state: [u32; 8]) -> [u32; 8] {
let mut state = state;
sha2::block_api::compress256(&mut state, &[msg]);
state
}
let msg = [69u8; 64];
let output: [u32; 8] = evaluate!(SHA256_COMPRESS, msg, SHA2_INITIAL_STATE).unwrap();
let expected = sha256_compress(msg, SHA2_INITIAL_STATE);
assert_eq!(output, expected);
}