{"id":45100,"library":"hkdf","title":"hkdf","description":"Python implementation of HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869. Current version 0.0.3. Low-maintenance, no recent releases.","status":"maintenance","version":"0.0.3","language":"python","source_language":"en","source_url":"https://github.com/casebeer/python-hkdf","tags":["hkdf","cryptography","key-derivation","hmac"],"install":[{"cmd":"pip install hkdf","lang":"bash","label":"pip install"}],"dependencies":[],"imports":[{"note":"The class is named Hkdf (capital H, lowercase kdf), not HKDF.","wrong":"from hkdf import HKDF","symbol":"Hkdf","correct":"from hkdf import Hkdf"},{"note":"The method is expand_key, not expand.","wrong":"hkdf = Hkdf(salt, ikm)\nkey = hkdf.expand(info, length)","symbol":"expand_key","correct":"from hkdf import Hkdf\nhkdf = Hkdf(salt, ikm)\nkey = hkdf.expand_key(info, length)"}],"quickstart":{"code":"from hkdf import Hkdf\nimport os\n\nikm = os.urandom(32)\nsalt = os.urandom(16)\ninfo = b'myapp key'\n\nhkdf = Hkdf(salt, ikm)\nkey = hkdf.expand_key(info, 32)\nprint(key.hex())","lang":"python","description":"Derive a 32-byte key using HKDF with random salt and input key material."},"warnings":[{"fix":"Use the cryptography library's HKDF implementation for better security and maintenance.","message":"The library is not actively maintained; consider using cryptography.hazmat.primitives.kdf.hkdf.HKDF instead.","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"Use from hkdf import Hkdf and call hkdf.expand_key(info, length).","message":"The class name is Hkdf (not HKDF) and the method is expand_key (not expand).","severity":"gotcha","affected_versions":">=0.0.3"}],"env_vars":null,"search_vec":"'0.0.3':23 '5869':20 'base':7 'cryptographi':31 'current':21 'defin':17 'deriv':13,34 'expand':11 'extract':9 'extract-and-expand':8 'function':14 'hkdf':1,15,30 'hmac':6,35 'hmac-bas':5 'implement':3 'key':12,33 'key-deriv':32 'low':25 'low-mainten':24 'mainten':26 'python':2 'recent':28 'releas':29 'rfc':19 'version':22","created_at":"2026-06-07T12:53:21.921741+00:00","updated_at":"2026-06-07T12:53:21.921741+00:00","problems":[{"fix":"Use from hkdf import Hkdf.","cause":"Using wrong case for class name; correct is Hkdf.","error":"ImportError: cannot import name 'HKDF' from 'hkdf'"},{"fix":"Use hkdf.expand_key(info, length) instead of hkdf.expand(info, length).","cause":"Using wrong method name; correct is expand_key.","error":"AttributeError: 'Hkdf' object has no attribute 'expand'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/casebeer/python-hkdf","github":"https://github.com/casebeer/python-hkdf","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}