Skip to content

Add HKDF implementation (RFC 5869) to the standard library #144613

@bitmooze

Description

@bitmooze

Feature or enhancement

Proposal:

Proposal: Add HKDF (HMAC-based Extract-and-Expand Key Derivation Function)

Background

HKDF is a widely used KDF defined in RFC 5869. It’s used in TLS 1.3, noise protocols, OAuth token derivation, and many other protocols.

Proposal

Add a pure-Python implementation of HKDF to the standard library:

  • Follows RFC 5869
  • Supports any hash algorithm in hashlib
  • Includes PRK and OKM derivation
  • Comprehensive RFC test vectors included

Example

from hkdf import HKDF
okm = HKDF(ikm, salt, hashlib.sha256).derive(length=42, info=b"info")

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions