arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
ark-r1cs-std/crypto-primitives/src/crh/mod.rs
crypto-primitives/src/crh/mod.rsRaw
 1use algebra_core::bytes::ToBytes;
 2use core::hash::Hash;
 3use rand::Rng;
 4
 5pub mod bowe_hopwood;
 6pub mod injective_map;
 7pub mod pedersen;
 8
 9use crate::Error;
10
11#[cfg(feature = "r1cs")]
12pub mod constraints;
13#[cfg(feature = "r1cs")]
14pub use constraints::*;
15
16pub trait FixedLengthCRH {
17    const INPUT_SIZE_BITS: usize;
18
19    type Output: ToBytes + Clone + Eq + core::fmt::Debug + Hash + Default;
20    type Parameters: Clone + Default;
21
22    fn setup<R: Rng>(r: &mut R) -> Result<Self::Parameters, Error>;
23    fn evaluate(parameters: &Self::Parameters, input: &[u8]) -> Result<Self::Output, Error>;
24}