#![allow(clippy::upper_case_acronyms)]
use ark_ff::bytes::ToBytes;
use ark_std::hash::Hash;
use ark_std::rand::Rng;
pub mod bowe_hopwood;
pub mod injective_map;
pub mod pedersen;
pub mod poseidon;
pub mod sha256;
use crate::Error;
#[cfg(feature = "r1cs")]
pub mod constraints;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::borrow::Borrow;
#[cfg(feature = "r1cs")]
pub use constraints::*;
pub trait CRHScheme {
type Input: ?Sized;
type Output: ToBytes
+ Clone
+ Eq
+ core::fmt::Debug
+ Hash
+ Default
+ CanonicalSerialize
+ CanonicalDeserialize;
type Parameters: Clone;
fn setup<R: Rng>(r: &mut R) -> Result<Self::Parameters, Error>;
fn evaluate<T: Borrow<Self::Input>>(
parameters: &Self::Parameters,
input: T,
) -> Result<Self::Output, Error>;
}
pub trait TwoToOneCRHScheme {
type Input: ?Sized;
type Output: ToBytes
+ Clone
+ Eq
+ core::fmt::Debug
+ Hash
+ Default
+ CanonicalSerialize
+ CanonicalDeserialize;
type Parameters: Clone;
fn setup<R: Rng>(r: &mut R) -> Result<Self::Parameters, Error>;
fn evaluate<T: Borrow<Self::Input>>(
parameters: &Self::Parameters,
left_input: T,
right_input: T,
) -> Result<Self::Output, Error>;
fn compress<T: Borrow<Self::Output>>(
parameters: &Self::Parameters,
left_input: T,
right_input: T,
) -> Result<Self::Output, Error>;
}
pub trait MMRTwoToOneCRHScheme {
type Input: ?Sized;
type Output: ToBytes
+ Clone
+ Eq
+ core::fmt::Debug
+ Hash
+ Default
+ CanonicalSerialize
+ CanonicalDeserialize;
type Parameters: Clone;
fn setup<R: Rng>(r: &mut R) -> Result<Self::Parameters, Error>;
fn evaluate<T: Borrow<Self::Input>>(
parameters: &Self::Parameters,
left_input: T,
right_input: T,
) -> Result<Self::Output, Error>;
fn compress<T: Borrow<Self::Output>>(
parameters: &Self::Parameters,
left_input: T,
right_input: T,
) -> Result<Self::Output, Error>;
fn left_compress(
parameters: &Self::Parameters,
left_input: &Self::Output,
right_input: &Self::Input,
) -> Result<Self::Output, Error>;
fn right_compress(
parameters: &Self::Parameters,
left_input: &Self::Input,
right_input: &Self::Output,
) -> Result<Self::Output, Error>;
}