pub trait HashOutput: private::Sealed {
type Type: Default;
}
pub trait CryptoHash: HashOutput + private::Sealed {
fn hash(input: &[u8], output: &mut <Self as HashOutput>::Type);
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Sha2x256 {}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Keccak256 {}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Blake2x256 {}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Blake2x128 {}
mod private {
pub trait Sealed {}
}
impl private::Sealed for Sha2x256 {}
impl private::Sealed for Keccak256 {}
impl private::Sealed for Blake2x256 {}
impl private::Sealed for Blake2x128 {}
impl HashOutput for Sha2x256 {
type Type = [u8; 32];
}
impl HashOutput for Keccak256 {
type Type = [u8; 32];
}
impl HashOutput for Blake2x256 {
type Type = [u8; 32];
}
impl HashOutput for Blake2x128 {
type Type = [u8; 16];
}