forceps 0.5.0

An easy-to-use async large file database/cache
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
pub(crate) const HASH_LEN: usize = 16;

/// Type definition for an array of bytes that make up an 16-byte hash (e.g., md5, xx3, etc.).
pub type HashBytes = [u8; HASH_LEN];

#[inline]
pub fn create(data: &[u8]) -> HashBytes {
    #[cfg(feature = "xxhash")]
    return twox_hash::XxHash3_128::oneshot(data).to_be_bytes();
    #[cfg(not(feature = "xxhash"))]
    return md5::compute(data).0;
}