Module: kdf_hkdf

class doubleratchet.recommended.kdf_hkdf.KDF[source]

Bases: KDF

This KDF implemention uses HKDF with SHA-256 or SHA-512, using the KDF key as HKDF salt, the KDF data as HKDF input key material, and an application-specific byte sequence as HKDF info. The info value should be chosen to be distinct from other uses of HKDF in the application.

https://signal.org/docs/specifications/doubleratchet/#recommended-cryptographic-algorithms

abstract static _get_hash_function()[source]
Return type

HashFunction

abstract static _get_info()[source]
Return type

bytes

async classmethod derive(key, data, length)[source]
Parameters
  • key (bytes) – The KDF key.

  • data (bytes) – The input data.

  • length (int) – The desired size of the output data, in bytes.

Return type

bytes

Returns

length bytes of output data, derived from the KDF key and the input data.