use super::*;
impl<E: Environment, const NUM_BITS: u8> HashUncompressed for Pedersen<E, NUM_BITS> {
type Input = bool;
type Output = Group<E>;
fn hash_uncompressed(&self, input: &[Self::Input]) -> Result<Self::Output> {
let mut input = Cow::Borrowed(input);
match input.len() <= NUM_BITS as usize {
true => input.to_mut().resize(NUM_BITS as usize, false),
false => bail!("Invalid input size for Pedersen: expected <= {NUM_BITS}, found {}", input.len()),
}
Ok(input
.iter()
.zip_eq(&*self.base_window)
.flat_map(|(bit, base)| match bit {
true => Some(*base),
false => None,
})
.sum())
}
}