zk_kit_pmt/
hasher.rs

1use crate::*;
2
3use std::fmt::Debug;
4
5/// Trait that must be implemented for Hash Function
6pub trait Hasher {
7    /// Native type for the hash-function
8    type Fr: Copy + Eq + Default + Sync + Send + Debug;
9
10    /// Serializes Self::Fr
11    fn serialize(value: Self::Fr) -> Value;
12
13    /// Deserializes Self::Fr
14    fn deserialize(value: Value) -> Self::Fr;
15
16    /// Outputs the default leaf (Fr::default())
17    fn default_leaf() -> Self::Fr {
18        Self::Fr::default()
19    }
20
21    /// Calculates hash-function
22    fn hash(input: &[Self::Fr]) -> Self::Fr;
23}