use rs_merkle::Hasher;
use sha3::{digest::FixedOutput, Digest};
#[derive(Clone, Copy, Debug)]
pub struct Sha3_256;
impl Hasher for Sha3_256 {
type Hash = [u8; 32];
fn hash(data: &[u8]) -> Self::Hash {
let mut hasher = sha3::Sha3_256::new();
hasher.update(data);
<[u8; 32]>::from(hasher.finalize_fixed())
}
}
#[derive(Clone, Copy, Debug)]
pub struct Sha3_512;
impl Hasher for Sha3_512 {
type Hash = [u8; 64];
fn hash(data: &[u8]) -> Self::Hash {
let mut hasher = sha3::Sha3_512::new();
hasher.update(data);
<[u8; 64]>::from(hasher.finalize_fixed())
}
}