[−][src]Trait iota_crypto_preview::Sponge
The common interface of cryptographic hash functions that follow the sponge construction, and that absorb and return binary-coded, balanced ternary.
Associated Types
type Error
An error indicating a that a failure has occured during absorb
.
Associated Constants
const IN_LEN: usize
The expected length of the input to the sponge.
const OUT_LEN: usize
The length of the hash squeezed from the sponge.
Required methods
fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>
Absorb input
into the sponge.
fn reset(&mut self)
Reset the inner state of the sponge.
fn squeeze_into(&mut self, buf: &mut Trits) -> Result<(), Self::Error>
Squeeze the sponge into a buffer
Provided methods
fn squeeze(&mut self) -> Result<TritBuf, Self::Error>
Convenience function using Sponge::squeeze_into
to to return an owned
version of the hash.
fn digest_into(
&mut self,
input: &Trits,
buf: &mut Trits
) -> Result<(), Self::Error>
&mut self,
input: &Trits,
buf: &mut Trits
) -> Result<(), Self::Error>
Convenience function to absorb input
, squeeze the sponge into a
buffer, and reset the sponge in one go.
fn digest(&mut self, input: &Trits) -> Result<TritBuf, Self::Error>
Convenience function to absorb input
, squeeze the sponge, and reset the sponge in one go.
Returns an owned versin of the hash.
Implementors
impl Sponge for CurlP
[src]
const IN_LEN: usize
[src]
const OUT_LEN: usize
[src]
type Error = Infallible
fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>
[src]
Absorb input
into the sponge by copying HASH_LEN
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_LEN
with the last chunk having n < HASH_LEN
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 reset(&mut self)
[src]
Reset the internal state by overwriting it with zeros.
fn squeeze_into(&mut self, buf: &mut Trits) -> 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_LEN
at a time.
If the last chunk is smaller than HASH_LEN
, then only the fraction that fits is written
into it.
impl Sponge for CurlP27
[src]
const IN_LEN: usize
[src]
const OUT_LEN: usize
[src]
type Error = Infallible
fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>
[src]
fn reset(&mut self)
[src]
fn squeeze_into(&mut self, buf: &mut Trits) -> Result<(), Self::Error>
[src]
impl Sponge for CurlP81
[src]
const IN_LEN: usize
[src]
const OUT_LEN: usize
[src]
type Error = Infallible
fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>
[src]
fn reset(&mut self)
[src]
fn squeeze_into(&mut self, buf: &mut Trits) -> Result<(), Self::Error>
[src]
impl Sponge for Kerl
[src]
const IN_LEN: usize
[src]
const OUT_LEN: usize
[src]
type Error = Error
fn absorb(&mut self, input: &Trits) -> Result<(), Self::Error>
[src]
Absorb input
into the sponge by copying HASH_LEN
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_LEN
with the last chunk having n < HASH_LEN
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 reset(&mut self)
[src]
Reset the internal state by overwriting it with zeros.
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_LEN
at a time.
If the last chunk is smaller than HASH_LEN
, then only the fraction that fits is written
into it.