Skip to Content
oxcrypto

One-step KDF

Hash-based one-step key derivation from NIST SP 800-56C with SHA-1, SHA-2 or SHA-3.

from oxcrypto.kdf.one_step_kdf import ONE_STEP_KDF

key = ONE_STEP_KDF.SHA256.derive(shared_secret, other_info=fixed_info, length=32)

The output is Hash(counter || Z || FixedInfo) blocks with a 32-bit counter starting at 1 (SP 800-56C option 1). Pass the encoded FixedInfo as other_info. shared_secret must not be empty and length must be at least 1 and less than HashLen * (2^32 - 1) bytes. Selectors: SHA1, SHA224, SHA256, SHA384, SHA512, SHA512_224, SHA512_256, SHA3_224, SHA3_256, SHA3_384 and SHA3_512. The HMAC and KMAC options are not provided by the upstream crate.

StandardNIST SP 800-56C Rev. 2 section 4.1, option 1 (also Concat KDF of SP 800-56A)
Crateone-step-kdf 0.1.0-rc.1
MaturityPre-release, no published audit
MSRVRust 1.85, builds with the project MSRV 1.88
ExperimentalNo. The algorithm is standardized; the crate API may change before 0.1.0.
ZeroizationEach hash output block, including the truncated tail of the last block, is not wiped.