Sha512 structv0.1.0

Source
An incremental SHA-512, SHA-384, SHA-512/224 or SHA-512/256.
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

Source

Associated functions

New384

pub func New384() -> Sha512

A SHA-384 state.

Returns: a hasher producing a 384-bit digest

Source

NewTrunc224

pub func NewTrunc224() -> Sha512

A SHA-512/224 state.

Returns: a hasher producing SHA-512/224

Source

NewTrunc256

pub func NewTrunc256() -> Sha512

A SHA-512/256 state.

Returns: a hasher producing SHA-512/256

Source

Implements Digest

Sha512 conforms to Digest.

Update

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

Adds bytes to the message.

NameTypeDescription
byteschar8[..]the bytes to absorb

Source

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.

NameTypeDescription
intovar char8[..]receives the output

Source

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

Source

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

Source

Sha512Of

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

The SHA-512 digest of bytes, in one call.

Source

Parameters

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

Sha384Of

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

The SHA-384 digest of bytes, in one call.

Source

Parameters

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

Sha512Trunc224Of

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

The SHA-512/224 digest of bytes, in one call.

Source

Parameters

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

Sha512Trunc256Of

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

The SHA-512/256 digest of bytes, in one call.

Source

Parameters

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