Skip to main content

Module kdf

Module kdf 

Source
Expand description

Key derivation functions

Tor has three relevant key derivation functions that we use for deriving keys used for relay encryption.

The KDF-TOR KDF (implemented by LegacyKdf) is used with the old TAP handshake. It is ugly, it is based on SHA-1, and it should be avoided for new uses.

The HKDF-SHA256 KDF (implemented by Ntor1Kdf) is used with the Ntor handshake. It is based on RFC5869 and SHA256.

The SHAKE KDF (implemented by ShakeKdf is used with v3 onion services, and is likely to be used by other places in the future. It is based on SHAKE-256.

Structsยง

LegacyKdf ๐Ÿ”’
A legacy KDF, for use with TAP.
Ntor1Kdf ๐Ÿ”’
A parameterized KDF, for use with ntor.
ShakeKdf ๐Ÿ”’
A modern KDF, for use with v3 onion services.

Traitsยง

Kdf ๐Ÿ”’
A trait for a key derivation function.