crdb_core/
hash.rs

1use crate::BinPtr;
2use ulid::Ulid;
3
4pub fn hash_binary(data: &[u8]) -> BinPtr {
5    use sha3::Digest;
6    let mut hasher = sha3::Sha3_224::new();
7    hasher.update(data);
8    BinPtr(Ulid::from_bytes(
9        hasher.finalize()[..16].try_into().unwrap(),
10    ))
11}