Skip to Content
oxcrypto

bake-kdf and belt-keyrep

Belarusian key derivation (STB 34.101.66) and key transformation (STB 34.101.31).

from oxcrypto.kdf.bake_kdf import BAKE_KDF, BELT_KEYREP

key = BAKE_KDF.BAKE_KDF.derive(shared_secret, info=public_data, number=0)
key = BELT_KEYREP.BELT_KEYREP.derive(
    master_key, level=bytes(12), header=bytes(16), length=32
)

BAKE_KDF.derive hashes secret || info with belt-hash and returns 32 bytes through belt-keyrep. number is the key number C, from 0 to 2**128 - 1.

BELT_KEYREP.derive transforms a 16, 24 or 32-byte key into a key of 16, 24 or 32 bytes that is not longer than the input. level is the 12-byte key level D and header the 16-byte key header I.

StandardSTB 34.101.66-2014 section 8.1.4 (bake-kdf), STB 34.101.31-2020 section 8.1.3 (belt-keyrep), national standards of Belarus
Cratebake-kdf 0.1.0-rc.1
MaturityPre-release, no published audit
MSRVRust 1.85, builds with the project MSRV 1.88
ExperimentalNo. The algorithms are standardized; the crate API may change before 0.1.0.
ZeroizationThe intermediate key Y, the expanded key schedule and the compression output are not wiped.