Skip to main content

Module hmac_sha1

Module hmac_sha1 

Source
Expand description

HMAC key minting (RFC 2104) over SHA-1 (FIPS 180-4), for interoperability with SHA-1-committed constructions — RFC 6238 TOTP, WPA2’s handshake PRF, and their contemporaries.

Security:

  • HMAC-SHA-1 is not affected by SHA-1’s collision breaks: HMAC’s security rests on the compression function’s PRF property, which stands. The construction is sound; only its hash is hygiene-stale. Prefer hmac-sha2 in new designs.
  • No SHA-1 digest is ever exposed here (the hash runs inside the construction); bare SHA-1 digests exist in this package only through sha1-checked.

Keys report algorithm-hash "SHA-1"; every other contract — key-length policy, length semantics (the block size, 512 bits, when none), JWK handling (alg "HS1") — is hmac-sha2’s, minus the variant parameter.

Functions§

derive_key
Mint a key from a parameterized derivation. See hmac-sha2.derive-key.
generate_key
Generate a fresh random HMAC-SHA-1 key. See hmac-sha2.generate-key for the length contract; none means SHA-1’s block size, 512 bits.
import_key_jwk
Import an RFC 7517 JSON Web Key as an HMAC-SHA-1 key (alg, when present, must be "HS1"). See hmac-sha2.import-key-jwk.
import_key_raw
Import raw key material as an HMAC-SHA-1 key. See hmac-sha2.import-key-raw for the key-length contract.
unwrap_key_jwk
Mint a key from unwrapped key material read as an RFC 7517 JSON Web Key. See hmac-sha2.unwrap-key-jwk.
unwrap_key_raw
Mint a key from unwrapped key material read as raw bytes. See hmac-sha2.unwrap-key-raw.

Type Aliases§

DeriveInput
Error
MacKey
MacKeyOptions
UnwrapInput