Trait zk_kit_pmt::hasher::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())

Object Safety§

This trait is not object safe.

Implementors§