Registry / crypto / x25519-dalek

x25519-dalek

JSON →
library2.0.1rscratesunverified

Pure Rust implementation of X25519 elliptic curve Diffie-Hellman key exchange using curve25519-dalek.

# Cargo.toml [dependencies] x25519-dalek = "2.0.1"
INSTALL
IMPORT
SIG · X25519-DALEK
X
x25519-dalek
cryptorustv2.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EphemeralSecret
use x25519_dalek::{EphemeralSecret, PublicKey};

Performs X25519 key exchange between two parties.

use x25519_dalek::{EphemeralSecret, PublicKey}; use rand::rngs::OsRng; let alice_secret = EphemeralSecret::new(OsRng); let alice_public = PublicKey::from(&alice_secret); let bob_secret = EphemeralSecret::new(OsRng); let bob_public = PublicKey::from(&bob_secret); let alice_shared = alice_secret.diffie_hellman(&bob_public); let bob_shared = bob_secret.diffie_hellman(&alice_public); assert_eq!(alice_shared.as_bytes(), bob_shared.as_bytes());
Debug
Known issues
gotchaEphemeralSecret should not be reused; use StaticSecret for long-term keys.
fix
Use `StaticSecret` instead of `EphemeralSecret` for persistent keys.
affects: >=2.0.0
Upgrade
Version history
2.0.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
28
Resources
x25519-dalek — cargo add x25519-dalek · libregistry