ristretto255-dh

Diffie-Hellman key exchange using the Ristretto255 group, in pure Rust.

This crate provides a high-level API for static and ephemeral Diffie-Hellman in the Ristretto255 prime order group, as specified the IETF draft, implemented internally over Curve25519 using [curve25519-dalek].

Example

``` use rand_core::OsRng;

use ristretto255dh::EphemeralSecret; use ristretto255dh::PublicKey;

// Alice's side let alicesecret = EphemeralSecret::new(&mut OsRng); let alicepublic = PublicKey::from(&alice_secret);

// Bob's side let bobsecret = EphemeralSecret::new(&mut OsRng); let bobpublic = PublicKey::from(&bob_secret);

// Alice again let alicesharedsecret = alicesecret.diffiehellman(&bob_public);

// Bob again let bobsharedsecret = bobsecret.diffiehellman(&alice_public);

// Each peer's computed shared secret should be the same. asserteq!(<[u8; 32]>::from(alicesharedsecret), <[u8; 32]>::from(bobshared_secret)); ```

About

The high-level Diffie-Hellman API is inspired by [x25519-dalek].