Trait ark_sponge::CryptographicSponge[][src]

pub trait CryptographicSponge: Clone {
    type Parameters;
    fn new(params: &Self::Parameters) -> Self;
fn absorb(&mut self, input: &impl Absorb);
fn squeeze_bytes(&mut self, num_bytes: usize) -> Vec<u8>;
fn squeeze_bits(&mut self, num_bits: usize) -> Vec<bool>; fn squeeze_field_elements_with_sizes<F: PrimeField>(
        &mut self,
        sizes: &[FieldElementSize]
    ) -> Vec<F> { ... }
fn squeeze_field_elements<F: PrimeField>(
        &mut self,
        num_elements: usize
    ) -> Vec<F> { ... }
fn fork(&self, domain: &[u8]) -> Self { ... } }
Expand description

The interface for a cryptographic sponge. A sponge can absorb or take in inputs and later squeeze or output bytes or field elements. The outputs are dependent on previous absorb and squeeze calls.

Associated Types

Parameters used by the sponge.

Required methods

Initialize a new instance of the sponge.

Absorb an input into the sponge.

Squeeze num_bytes bytes from the sponge.

Squeeze num_bits bits from the sponge.

Provided methods

Squeeze sizes.len() field elements from the sponge, where the i-th element of the output has size sizes[i].

If the implementation is field-based, to squeeze native field elements, call self.squeeze_native_field_elements instead.

TODO: Support general Field.

Note that when FieldElementSize is FULL, the output is not strictly uniform. Output space is uniform in [0, 2^{F::MODULUS_BITS - 1}]

Squeeze num_elements nonnative field elements from the sponge.

Because of rust limitation, for field-based implementation, using this method to squeeze native field elements will have runtime casting cost. For better efficiency, use squeeze_native_field_elements.

Creates a new sponge with applied domain separation.

Implementors