pub fn hash(t: MessageDigest, data: &[u8]) -> Result<DigestBytes, ErrorStack>
Expand description
Computes the hash of the data
with the non-XOF hasher t
.
Examples
use openssl::hash::{hash, MessageDigest};
let data = b"\x42\xF4\x97\xE0";
let spec = b"\x7c\x43\x0f\x17\x8a\xef\xdf\x14\x87\xfe\xe7\x14\x4e\x96\x41\xe2";
let res = hash(MessageDigest::md5(), data)?;
assert_eq!(&*res, spec);