Shake structv0.1.0
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
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
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.
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
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.
| Name | Type | Description |
|---|---|---|
into | var char8[..] | receives the output |
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
Related
Shake128Of
pub func Shake128Of(bytes: char8[..], into: var char8[..])
into.length bytes of SHAKE128 over bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Shake256Of
pub func Shake256Of(bytes: char8[..], into: var char8[..])
into.length bytes of SHAKE256 over bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |