Module cryptoxide::x25519

source ·
Expand description

X25519 - diffie hellman using curve25519

Curve25519 elliptic curve from Specification, and extra information also on Wikipedia

Example

Creating a curve25519 point from a secret:

use cryptoxide::x25519;

let secret = x25519::SecretKey::from([0,1,2,3,4,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
let public = x25519::base(&secret);

Doing a ECDH on curve25519 using a curve point ‘other_point’ and a specific secret:

use cryptoxide::x25519;

let secret = x25519::SecretKey::from([0,1,2,3,4,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
let shared_secret = x25519::dh(&secret, &other_public);

Structs

Public Key
Secret Key

Functions

Derives a public key from a private key
Computes a shared secret from the curve25519 private key (n) and public key (p)