Trait filecoin_hashers::HashFunction
source · pub trait HashFunction<T: Domain>: Clone + Debug + Send + Sync + LightAlgorithm<T> {
// Required methods
fn hash(data: &[u8]) -> T;
fn hash2(a: &T, b: &T) -> T;
fn hash_multi_leaf_circuit<Arity: 'static + PoseidonArity, CS: ConstraintSystem<Fr>>(
cs: CS,
leaves: &[AllocatedNum<Fr>],
height: usize,
) -> Result<AllocatedNum<Fr>, SynthesisError>;
fn hash_circuit<CS: ConstraintSystem<Fr>>(
cs: CS,
bits: &[Boolean],
) -> Result<AllocatedNum<Fr>, SynthesisError>;
fn hash2_circuit<CS>(
cs: CS,
a: &AllocatedNum<Fr>,
b: &AllocatedNum<Fr>,
) -> Result<AllocatedNum<Fr>, SynthesisError>
where CS: ConstraintSystem<Fr>;
// Provided methods
fn hash_md(input: &[T]) -> T { ... }
fn hash_leaf(data: &dyn LightHashable<Self>) -> T { ... }
fn hash_single_node(data: &dyn LightHashable<Self>) -> T { ... }
fn hash_leaf_circuit<CS: ConstraintSystem<Fr>>(
cs: CS,
left: &AllocatedNum<Fr>,
right: &AllocatedNum<Fr>,
height: usize,
) -> Result<AllocatedNum<Fr>, SynthesisError> { ... }
fn hash_md_circuit<CS: ConstraintSystem<Fr>>(
_cs: &mut CS,
_elements: &[AllocatedNum<Fr>],
) -> Result<AllocatedNum<Fr>, SynthesisError> { ... }
fn hash_leaf_bits_circuit<CS: ConstraintSystem<Fr>>(
_cs: CS,
_left: &[Boolean],
_right: &[Boolean],
_height: usize,
) -> Result<AllocatedNum<Fr>, SynthesisError> { ... }
}
Required Methods§
fn hash(data: &[u8]) -> T
fn hash2(a: &T, b: &T) -> T
fn hash_multi_leaf_circuit<Arity: 'static + PoseidonArity, CS: ConstraintSystem<Fr>>( cs: CS, leaves: &[AllocatedNum<Fr>], height: usize, ) -> Result<AllocatedNum<Fr>, SynthesisError>
fn hash_circuit<CS: ConstraintSystem<Fr>>( cs: CS, bits: &[Boolean], ) -> Result<AllocatedNum<Fr>, SynthesisError>
fn hash2_circuit<CS>(
cs: CS,
a: &AllocatedNum<Fr>,
b: &AllocatedNum<Fr>,
) -> Result<AllocatedNum<Fr>, SynthesisError>where
CS: ConstraintSystem<Fr>,
Provided Methods§
fn hash_md(input: &[T]) -> T
fn hash_leaf(data: &dyn LightHashable<Self>) -> T
fn hash_single_node(data: &dyn LightHashable<Self>) -> T
fn hash_leaf_circuit<CS: ConstraintSystem<Fr>>( cs: CS, left: &AllocatedNum<Fr>, right: &AllocatedNum<Fr>, height: usize, ) -> Result<AllocatedNum<Fr>, SynthesisError>
fn hash_md_circuit<CS: ConstraintSystem<Fr>>( _cs: &mut CS, _elements: &[AllocatedNum<Fr>], ) -> Result<AllocatedNum<Fr>, SynthesisError>
fn hash_leaf_bits_circuit<CS: ConstraintSystem<Fr>>( _cs: CS, _left: &[Boolean], _right: &[Boolean], _height: usize, ) -> Result<AllocatedNum<Fr>, SynthesisError>
Object Safety§
This trait is not object safe.