pub fn digest(algorithm: Algorithm, data: &[u8]) -> Vec<u8>
Expand description
Helper function for Hasher
which generates a cryptographic digest from the given
data and algorithm.
ยงExamples
use crypto_hash::{Algorithm, digest};
let data = b"crypto-hash";
let result = digest(Algorithm::SHA256, data);
let expected =
b"\xfd\x1a\xfb`\"\xcdMG\xc8\x90\x96\x1cS9(\xea\xcf\xe8!\x9f\x1b%$\xf7\xfb*a\x84}\xdf\x8c'"
.to_vec();
assert_eq!(expected, result)