Skip to content

SHA-3 and HMAC keygen #23

@panva

Description

@panva
dictionary HmacKeyGenParams : Algorithm {
  required HashAlgorithmIdentifier hash;
  [EnforceRange] unsigned long length;
};

The hash member represents the inner hash function to use.

The length member represent the length (in bits) of the key to generate. If unspecified, the recommended length will be used, which is the size of the associated hash function's block size.

In Node's initial implementation I've used the rate (R) SHA-3's sponge construction to inform the default HMAC length.

That is

SHA3-256: Rate (R) = 1088 bits
SHA3-384: Rate (R) = 832 bits
SHA3-512: Rate (R) = 576 bits

But it seems counter-intuitive that the larger the SHA is the shorter the key would be.

The alternative would be to use the Capacity (C) which is 1600-R

SHA3-256: Capacity (C) = 512 bits
SHA3-384: Capacity (C) = 768 bits
SHA3-512: Capacity (C) = 1024 bits

Can we clarify which is right to use as the default HmacKeyGenParams when SHA-3 hash is used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions