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::bytes::ToBytes;
 2use rand::Rng;
 3use std::hash::Hash;
 4
 5pub mod injective_map;
 6pub mod pedersen;
 7
 8use crate::Error;
 9
10
11#[cfg(feature = "r1cs")]
12pub mod constraints;
13#[cfg(feature = "r1cs")]
14pub use constraints::*;
15
16
17pub trait FixedLengthCRH {
18    const INPUT_SIZE_BITS: usize;
19    type Output: ToBytes + Clone + Eq + 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}