#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(docsrs, feature(doc_cfg))]
mod arch;
mod backend;
#[cfg(feature = "c")]
#[cfg_attr(docsrs, doc(cfg(feature = "c")))]
pub mod c;
mod const_fn;
#[cfg(feature = "cpu")]
#[cfg_attr(docsrs, doc(cfg(feature = "cpu")))]
pub mod cpu;
mod hasher;
#[cfg(feature = "std")]
mod map;
pub mod seed;
mod state;
mod stream;
pub use hasher::{IBuildHasher, IHasher};
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub use map::{HashMap, HashMapExt, HashSet, HashSetExt};
pub use stream::Stream;
use crate::{
arch::Active,
backend::{ActiveBackend, Platform},
stream::fill_xof_root,
};
#[must_use]
#[cfg_attr(not(debug_assertions), inline(always))]
#[cfg_attr(debug_assertions, inline)]
pub fn hash32(data: &[u8]) -> u32 {
Active::hash32::<true>(data, 0)
}
#[must_use]
#[cfg_attr(not(debug_assertions), inline(always))]
#[cfg_attr(debug_assertions, inline)]
pub fn hash64(data: &[u8]) -> u64 {
Active::hash64::<true>(data, 0)
}
#[must_use]
#[cfg_attr(not(debug_assertions), inline(always))]
#[cfg_attr(debug_assertions, inline)]
pub fn hash128(data: &[u8]) -> u128 {
Active::hash128::<true>(data, 0)
}
#[must_use]
#[cfg_attr(not(debug_assertions), inline(always))]
#[cfg_attr(debug_assertions, inline)]
pub fn hash256(data: &[u8]) -> [u8; 32] {
Active::hash256::<true>(data, 0)
}
#[inline]
pub fn hash_xof(data: &[u8], out: &mut [u8]) {
if out.is_empty() {
return;
}
fill_xof_root(hash256(data), out, ActiveBackend);
}