Skip to main content

MIN_HMAC_SECRET_LEN

Constant MIN_HMAC_SECRET_LEN 

Source
pub const MIN_HMAC_SECRET_LEN: usize = 32; // 32usize
Expand description

The shortest HMAC secret accepted, in bytes.

32 bytes is SHA-256’s output size, the key length RFC 2104 recommends as a floor. It is also what makes the kid safe to publish: a Mac0 kid is a prefix of the secret’s RFC 9679 thumbprint, and RFC 9679 §7 forbids thumbprints of low-entropy secrets because a short one could be found by hashing candidates (P0 scoping decision).