from Crypto.Protocol.KDF import HKDF as baseHKDF # https://www.pycryptodome.org/src/protocol/kdf#hkdf # https://cryptography.io/en/latest/hazmat/primitives/key-derivation-functions/#hkdf class HKDF: def __init__(self, algorithm, length, salt, info, backend=None): self._algo = algorithm self._len = length self._salt = salt self._info = info def derive(self, key): return baseHKDF(key, self._len, self._salt, self._algo, context=self._info)