oqs-safe 0.5.0

Post-Quantum Cryptography (PQC) toolkit in Rust with ML-KEM, ML-DSA, hybrid cryptography (X25519 + ML-KEM), and secure session primitives.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use x25519_dalek::{PublicKey, StaticSecret};

pub fn x25519_keypair() -> (PublicKey, StaticSecret) {
    let sk = StaticSecret::random_from_rng(rand_core::OsRng);
    let pk = PublicKey::from(&sk);
    (pk, sk)
}

pub fn x25519_shared_secret(sk: &StaticSecret, pk: &PublicKey) -> [u8; 32] {
    sk.diffie_hellman(pk).to_bytes()
}