Sha512 structv0.1.0
pub struct Sha512 {
// private fields
}
Structural Copy; copying takes an independent snapshot of the digest state.
Constructors
Sha512
pub func Sha512() -> Sha512
A SHA-512 state.
Returns: a hasher producing a 512-bit digest
Associated functions
New384
pub func New384() -> Sha512
A SHA-384 state.
Returns: a hasher producing a 384-bit digest
NewTrunc224
pub func NewTrunc224() -> Sha512
A SHA-512/224 state.
Returns: a hasher producing SHA-512/224
NewTrunc256
pub func NewTrunc256() -> Sha512
A SHA-512/256 state.
Returns: a hasher producing SHA-512/256
Implements Digest
Sha512 conforms to Digest.
Update
pub func Update(self: &var Sha512, bytes: char8[..])
Adds bytes to the message.
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
Finish
pub func Finish(self: &var Sha512, into: var char8[..])
Writes the digest into into.
The padding carries a hundred and twenty eight bit length, so the final block needs seventeen free bytes
rather than nine; a block with fewer takes a whole further block.
| Name | Type | Description |
|---|---|---|
into | var char8[..] | receives the output |
DigestLength
pub func DigestLength(self: &Sha512) -> uint
Sixty-four, forty-eight, thirty-two or twenty-eight bytes, depending on which variant this is.
Returns: how many bytes a digest occupies
BlockLength
pub func BlockLength(self: &Sha512) -> uint
A hundred and twenty eight bytes, for every variant.
Returns: how many bytes the compression function consumes at a time
Related
Sha512Of
pub func Sha512Of(bytes: char8[..], into: var char8[..])
The SHA-512 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Sha384Of
pub func Sha384Of(bytes: char8[..], into: var char8[..])
The SHA-384 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Sha512Trunc224Of
pub func Sha512Trunc224Of(
bytes: char8[..],
into: var char8[..]
)
The SHA-512/224 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |
Sha512Trunc256Of
pub func Sha512Trunc256Of(
bytes: char8[..],
into: var char8[..]
)
The SHA-512/256 digest of bytes, in one call.
Parameters
| Name | Type | Description |
|---|---|---|
bytes | char8[..] | the bytes to absorb |
into | var char8[..] | receives the output |