sponge_preview/
lib.rs

1#![no_std]
2
3pub trait Sponge
4where
5    Self: Default + Clone,
6{
7    type Item;
8
9    /// Absorb trits into the sponge
10    fn absorb(&mut self, input: &[Self::Item]);
11    
12    /// Squeeze trits out of the sponge and copy them into `out`
13    fn squeeze(&mut self, output: &mut [Self::Item]);
14
15    /// Reset the sponge to initial state
16    fn reset(&mut self);
17
18    /// Digest inputs and then compute the hash with length of provided output slice
19    fn digest (&mut self, input: &[Self::Item], output: &mut [Self::Item]) {
20        self.absorb(input);
21        self.squeeze(output);
22    }
23}