Trait Hasher

Source
pub trait Hasher {
    type Fr: Copy + Eq + Default + Sync + Send + Debug;

    // Required methods
    fn serialize(value: Self::Fr) -> Value;
    fn deserialize(value: Value) -> Self::Fr;
    fn hash(input: &[Self::Fr]) -> Self::Fr;

    // Provided method
    fn default_leaf() -> Self::Fr { ... }
}
Expand description

Trait that must be implemented for Hash Function

Required Associated Types§

Source

type Fr: Copy + Eq + Default + Sync + Send + Debug

Native type for the hash-function

Required Methods§

Source

fn serialize(value: Self::Fr) -> Value

Serializes Self::Fr

Source

fn deserialize(value: Value) -> Self::Fr

Deserializes Self::Fr

Source

fn hash(input: &[Self::Fr]) -> Self::Fr

Calculates hash-function

Provided Methods§

Source

fn default_leaf() -> Self::Fr

Outputs the default leaf (Fr::default())

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§