aboutsummaryrefslogtreecommitdiff
path: root/src/hash.rs
blob: 6382a7a995abfb8efee7e5e063a61724b1323d31 (plain)
1
2
3
4
5
6
7
8
9
10
//! Module implementing various hashing utilities.

use sha2::{Digest, Sha256};

/// Returns the SHA256 hash of the specified input.
pub fn sha256(data: impl AsRef<[u8]>) -> [u8; 32] {
    let mut hasher = Sha256::new();
    hasher.update(data.as_ref());
    hasher.finalize().into()
}