Sha3 structv0.1.0
pub struct Sha3 {
// private fields
}
Structural Copy; copying takes an independent snapshot of the sponge state.
Associated functions
New224
pub func New224() -> Sha3
A SHA3-224 state.
Returns: a hasher producing a 224-bit digest
New256
pub func New256() -> Sha3
A SHA3-256 state.
Returns: a hasher producing a 256-bit digest
New384
pub func New384() -> Sha3
A SHA3-384 state.
Returns: a hasher producing a 384-bit digest
New512
pub func New512() -> Sha3
A SHA3-512 state.
Returns: a hasher producing a 512-bit digest
Implements Digest
Sha3 conforms to Digest.
Update
pub func Update(self: &var Sha3, bytes: char8[..])
Absorbs bytes into the state.
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
Finish
pub func Finish(self: &var Sha3, into: var char8[..])
Pads, permutes once more, and squeezes the digest out. The padding is the domain byte, then zeros, then a final bit at the top of the rate — so a rate with only one byte free receives both in the same byte, which is the case that separates a correct padding from one that works at every other length.
| Name | Type | Description |
|---|---|---|
into | var char8[..] | receives the output |
DigestLength
pub func DigestLength(self: &Sha3) -> uint
Twenty-eight, thirty-two, forty-eight or sixty-four bytes.
Returns: how many bytes a digest occupies
BlockLength
pub func BlockLength(self: &Sha3) -> uint
The rate, which differs per size — unlike the SHA-2 family, whose block is fixed.
Returns: how many bytes the compression function consumes at a time
Related
KeccakPermute
pub func KeccakPermute(lanes: *var uint64)
The Keccak-f1600 permutation, applied in place to twenty-five lanes. Twenty-four rounds of five steps: theta mixes each column into its neighbours, rho rotates each lane by its own offset, pi moves the lanes around, chi is the only non-linear step, and iota breaks the symmetry that would otherwise make every round identical.
Parameters
| Name | Type | Description |
|---|---|---|
lanes | *var uint64 | the state's twenty-five lanes, permuted in place |
Sha3Of224
pub func Sha3Of224(bytes: char8[..], into: var char8[..])
The SHA3-224 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Sha3Of256
pub func Sha3Of256(bytes: char8[..], into: var char8[..])
The SHA3-256 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Sha3Of384
pub func Sha3Of384(bytes: char8[..], into: var char8[..])
The SHA3-384 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Sha3Of512
pub func Sha3Of512(bytes: char8[..], into: var char8[..])
The SHA3-512 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |