canic_utils/
wasm.rs

1//!
2//! WASM utilities such as hashing embedded modules with SHA-256.
3//!
4
5use sha2::{Digest, Sha256};
6
7///
8/// Compute the SHA-256 hash of a WASM byte slice.
9///
10#[must_use]
11pub fn get_wasm_hash(bytes: &[u8]) -> Vec<u8> {
12    let mut hasher = Sha256::new();
13    hasher.update(bytes);
14
15    hasher.finalize().to_vec()
16}