hopr_crypto_sphinx

Module derivation

Source
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 on SimpleMac
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 via sample_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 via sample_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> The secret must be at least SecretKey::LENGTH long. The tag parameter will be used as an additional Domain Separation Tag.