Shake structv0.1.0

Source
An extendable-output function: absorb a message, then read as many bytes as wanted.
pub struct Shake {
    // private fields
}

Structural Copy; copying takes an independent snapshot of the sponge and read position.

Associated functions

New128

pub func New128() -> Shake

A SHAKE128 state: 128 bits of security, absorbing 168 bytes at a time.

Returns: a SHAKE128 sponge, which produces output of any length

Source

New256

pub func New256() -> Shake

A SHAKE256 state: 256 bits of security, absorbing 136 bytes at a time.

Returns: a SHAKE256 sponge, which produces output of any length

Source

Methods

Update

pub func Update(self: &var Shake, bytes: char8[..])

Absorbs bytes into the state. Absorbing after reading has begun is a caller error: the stream is a function of everything absorbed before the first read, and adding to it afterwards would silently change what a caller already has. This ignores such a call rather than corrupting the stream.

NameTypeDescription
byteschar8[..]the bytes to absorb

Source

Read

pub func Read(self: &var Shake, into: var char8[..])

Fills into with the next bytes of the stream. Reading is continuous: any sequence of reads totalling the same number of bytes gives the same bytes. The first read applies the padding, after which Update does nothing.

NameTypeDescription
intovar char8[..]receives the output

Source

Rate

pub func Rate(self: &Shake) -> uint

How many bytes the state absorbs or squeezes before permuting.

Returns: how many bytes the sponge absorbs or squeezes per permutation

Source

Shake128Of

pub func Shake128Of(bytes: char8[..], into: var char8[..])

into.length bytes of SHAKE128 over bytes, in one call.

Source

Parameters

NameTypeDescription
byteschar8[..]the bytes to absorb
intovar char8[..]receives the output

Shake256Of

pub func Shake256Of(bytes: char8[..], into: var char8[..])

into.length bytes of SHAKE256 over bytes, in one call.

Source

Parameters

NameTypeDescription
byteschar8[..]the bytes to absorb
intovar char8[..]receives the output