use core::fmt::Debug;
#[cfg(feature = "blake3")]
pub mod blake3;
#[cfg(feature = "sha2")]
pub mod sha256;
#[cfg(feature = "sha3")]
pub mod sha3;
#[cfg(not(any(feature = "blake3", feature = "sha2", feature = "sha3")))]
compile_error!("At least one hashing feature must be enabled: 'blake3', 'sha2' or 'sha3'");
pub trait Hasher: Clone + Debug + Send + Sync + 'static {
const OUTPUT_SIZE: usize;
fn new() -> Self;
fn update(&mut self, data: &[u8]);
fn finalize(self) -> [u8; 32];
fn finalize_reset(&mut self) -> [u8; 32];
}
#[cfg(feature = "sha3")]
pub type DefaultHasher = sha3::Sha3_256Hasher;
#[cfg(all(feature = "sha2", not(feature = "sha3")))]
pub type DefaultHasher = sha256::Sha256Hasher;
#[cfg(all(feature = "blake3", not(feature = "sha3"), not(feature = "sha2")))]
pub type DefaultHasher = blake3::Blake3Hasher;
#[cfg(feature = "sha3")]
#[inline]
pub const fn default_hasher_name() -> &'static str {
"hekate_crypto::sha3::Sha3_256Hasher"
}
#[cfg(all(feature = "sha2", not(feature = "sha3")))]
#[inline]
pub const fn default_hasher_name() -> &'static str {
"hekate_crypto::sha256::Sha256Hasher"
}
#[cfg(all(feature = "blake3", not(feature = "sha3"), not(feature = "sha2")))]
#[inline]
pub const fn default_hasher_name() -> &'static str {
"hekate_crypto::blake3::Blake3Hasher"
}