Crate hopr_crypto_sphinx

Source
Expand description

This Rust crate contains an implementation of the Sphinx packet format for the HOPR protocol.

§SPHINX shared keys derivation

The architecture of the SPHINX shared key derivation is done generically, so it can work with any elliptic curve group for which the CDH problem is hard. The generic Sphinx implementation only requires one to implement the SphinxSuite trait.

The trait requires having the following building blocks:

  • elliptic curve group (GroupElement) and corresponding the scalar type (Scalar)
  • type representing public and private keypair and their conversion to Scalar and GroupElement (by the means of the corresponding From trait implementation)

Currently, there are the following SphinxSuite implementations:

  • Secp256k1Suite: deprecated, used in previous HOPR versions
  • Ed25519Suite: simple implementation using Ed25519, used for testing
  • X25519Suite currently used, implemented using the Curve25519 Montgomery curve for faster computation

The implementation can be easily extended for different elliptic curves (or even arithmetic multiplicative groups). In particular, as soon as there is a way to represent Ed448 PeerIDs, it would be easy to create e.g., an X448Suite.

Modules§

errors
Contains various errors returned from this crate.
prelude