Expand description
Contains simple key derivation functions for different purposes
Constants§
- PING_
PONG_ NONCE_ SIZE - Size of the nonce in the Ping sub protocol
Functions§
- create_
tagged_ mac - Calculates a message authentication code with fixed key tag (HASH_KEY_HMAC)
The given
secret
is first transformed using HKDF before the MAC calculation is performed. Based onSimpleMac
- derive_
ack_ key_ share - Used in Proof of Relay to derive the half-key of for the acknowledgement (S1)
The function samples a secp256k1 field element using the given
secret
viasample_field_element
. - derive_
commitment_ seed - Derives the commitment seed given the compressed private key representation and the serialized channel information.
- derive_
mac_ key - Derives a key for MAC calculation by expanding the given secret.
- derive_
own_ key_ share - Used in Proof of Relay to derive own half-key (S0)
The function samples a secp256k1 field element using the given
secret
viasample_field_element
. - derive_
packet_ tag - Derives the packet tag used during packet construction by expanding the given secret.
- derive_
ping_ pong - Derives a ping challenge (if no challenge is given) or a pong response to a ping challenge.
- sample_
secp256k1_ field_ element - Sample a random secp256k1 field element that can represent a valid secp256k1 point.
The implementation uses
hash_to_field
function as defined in<https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-13.html#name-hashing-to-a-finite-field>
Thesecret
must be at leastSecretKey::LENGTH
long. Thetag
parameter will be used as an additional Domain Separation Tag.