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