[][src]Trait bee_crypto::ternary::sponge::Sponge

pub trait Sponge {
    type Error;
    fn reset(&mut self);
fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>;
fn squeeze_into(&mut self, buf: &mut Trits) -> Result<(), Self::Error>; fn squeeze(&mut self) -> Result<TritBuf, Self::Error> { ... }
fn digest_into(
        &mut self,
        input: &Trits,
        buf: &mut Trits
    ) -> Result<(), Self::Error> { ... }
fn digest(&mut self, input: &Trits) -> Result<TritBuf, Self::Error> { ... } }

The common interface of ternary cryptographic hash functions that follow the sponge construction.

Associated Types

type Error

An error indicating that a failure has occured during a sponge operation.

Loading content...

Required methods

fn reset(&mut self)

Reset the inner state of the sponge.

fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>

Absorb input into the sponge.

fn squeeze_into(&mut self, buf: &mut Trits) -> Result<(), Self::Error>

Squeeze the sponge into buf.

Loading content...

Provided methods

fn squeeze(&mut self) -> Result<TritBuf, Self::Error>

Convenience function using Sponge::squeeze_into to return an owned output.

fn digest_into(
    &mut self,
    input: &Trits,
    buf: &mut Trits
) -> Result<(), Self::Error>

Convenience function to absorb input, squeeze the sponge into buf, and reset the sponge.

fn digest(&mut self, input: &Trits) -> Result<TritBuf, Self::Error>

Convenience function to absorb input, squeeze the sponge, reset the sponge and return an owned output.

Loading content...

Implementors

impl Sponge for CurlP[src]

type Error = Infallible

fn reset(&mut self)[src]

Reset the internal state by overwriting it with zeros.

fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>[src]

Absorb input into the sponge by copying HASH_LENGTH chunks of it into its internal state and transforming the state before moving on to the next chunk.

If input is not a multiple of HASH_LENGTH with the last chunk having n < HASH_LENGTH trits, the last chunk will be copied to the first n slots of the internal state. The remaining data in the internal state is then just the result of the last transformation before the data was copied, and will be reused for the next transformation.

fn squeeze_into(&mut self, buf: &mut Trits) -> Result<(), Self::Error>[src]

Squeeze the sponge by copying the state into the provided buf. This will fill the buffer in chunks of HASH_LENGTH at a time.

If the last chunk is smaller than HASH_LENGTH, then only the fraction that fits is written into it.

impl Sponge for Kerl[src]

type Error = Error

fn reset(&mut self)[src]

Reset the internal state by overwriting it with zeros.

fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>[src]

Absorb input into the sponge by copying HASH_LENGTH chunks of it into its internal state and transforming the state before moving on to the next chunk.

If input is not a multiple of HASH_LENGTH with the last chunk having n < HASH_LENGTH trits, the last chunk will be copied to the first n slots of the internal state. The remaining data in the internal state is then just the result of the last transformation before the data was copied, and will be reused for the next transformation.

fn squeeze_into(&mut self, buf: &mut Trits<T1B1>) -> Result<(), Self::Error>[src]

Squeeze the sponge by copying the calculated hash into the provided buf. This will fill the buffer in chunks of HASH_LENGTH at a time.

If the last chunk is smaller than HASH_LENGTH, then only the fraction that fits is written into it.

impl<T: Sponge, U: DerefMut<Target = T>> Sponge for U[src]

type Error = T::Error

Loading content...