Noise.Crypto.DH.Secp256k1 (Noise Protocol v0.3.0)

View Source

secp256k1 Diffie-Hellman, via the optional lib_secp256k1 dependency.

secp256k1 is not one of the DH functions defined by the Noise specification. This module follows the convention established by Lightning's BOLT-8 (Noise_XK_secp256k1_ChaChaPoly_SHA256):

  • DHLEN is 33 — public keys are transmitted in compressed SEC1 form.
  • DH() returns SHA256(compressed shared point), 32 bytes, which is libsecp256k1's default ECDH output.

Only available when {:lib_secp256k1, "~> 0.8"} is in your dependencies.