Hkdf<D> functionv0.1.0

Source
Extract and expand in one call: the whole of HKDF.
pub func Hkdf<D: Digest>(
    prototype: D,
    salt: char8[..],
    material: char8[..],
    info: char8[..],
    into: var char8[..]
) -> bool

Returns false for an output longer than 255 digests, exactly as HkdfExpand does.

Type parameters

NameDescription
D: Digestthe digest type

Parameters

NameTypeDescription
prototypeDany value of the digest type, read only to select it
saltchar8[..]the salt, which may be empty
materialchar8[..]the input keying material
infochar8[..]the context and application-specific information
intovar char8[..]receives the output

Returns: whether into was a length this construction can produce

HkdfMaximumBlocks

pub const HkdfMaximumBlocks: uint = 255;

The most blocks Expand can produce, since its counter is one byte.

Source

HkdfExtract<D>

pub func HkdfExtract<D: Digest>(
    prototype: D,
    salt: char8[..],
    material: char8[..],
    into: var char8[..]
)

Extracts a pseudorandom key from material, salted with salt. into must be exactly the digest's length. An empty salt is legal and means a string of that many zeros, which is what the specification says — so an absent salt is not the same as no salt at all.

Source

Type parameters

NameDescription
D: Digestthe digest type

Parameters

NameTypeDescription
prototypeDany value of the digest type, read only to select it
saltchar8[..]the salt, which may be empty
materialchar8[..]the input keying material
intovar char8[..]receives the output

HkdfExpand<D>

pub func HkdfExpand<D: Digest>(
    prototype: D,
    key: char8[..],
    info: char8[..],
    into: var char8[..]
) -> bool

Expands key into into, separated by info. Returns false when into is longer than 255 digests, which is the most the one-byte counter can address; nothing is written in that case. info names what the derived key is for, and two expansions of one key under different info strings are unrelated.

Source

Type parameters

NameDescription
D: Digestthe digest type

Parameters

NameTypeDescription
prototypeDany value of the digest type, read only to select it
keychar8[..]the key
infochar8[..]the context and application-specific information
intovar char8[..]receives the output

Returns: whether into was a length this construction can produce