Skip to Content
oxcrypto

ANSI X9.63 KDF

Hash-based key derivation from ANSI X9.63 and SEC 1 with SHA-1, SHA-2 or SHA-3.

from oxcrypto.kdf.ansi_x963_kdf import ANSI_X963_KDF

key = ANSI_X963_KDF.SHA256.derive(shared_secret, shared_info=b"context", length=32)

The output is Hash(Z || counter || SharedInfo) blocks with a 32-bit counter starting at 1. 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.

StandardANSI X9.63-2011, SEC 1 v2.0 section 3.6.1, NIST SP 800-135 Rev. 1 section 4.1
Crateansi-x963-kdf 0.1.0
MaturityStable release, no published audit
MSRVRust 1.85, builds with the project MSRV 1.88
ExperimentalNo
ZeroizationEach hash output block, including the truncated tail of the last block, is not wiped.