A pure rust implementation of the Module-Lattice-based standards ML-KEM and (soon) ML-DSA, also known as the PQC scheme Crystals Kyber and Dilithium.
This package consists of a library (enc_rust
), and (soon :TM:) a binary wrapper. The library currently contains implementations for ML-KEM (Kyber), and will in the future also support ML-DSA (Dilithium).
enc_rust aims to provide a secure, efficient, and ergonomic solution to any problem that requires quantum secure cryptography.
- No unsafe code
no_std
compatible- ergonomic
enc_rust currently supports ML-KEM as a sole mechanism, but will provide:
- ML-KEM in hybrid with x25519
- ML-DSA
- ML-DSA in hybrid with Ed25519
cargo add enc_rust
or
cargo add --git https://github.com/supinie/enc_rust
.
use enc_rust::kem::*;
fn alice(pk: PublicKey) -> (Ciphertext, [u8; 32]) {
let (ciphertext, shared_secret) = pk.encapsulate(None, None).unwrap();
(ciphertext, shared_secret)
}
fn bob(sk: PrivateKey, ciphertext: &[u8]) -> [u8; 32] {
let shared_secret = sk.decapsulate(ciphertext).unwrap();
shared_secret
}
fn main() {
let (pk, sk) = generate_keypair_768(None).unwrap();
let (ciphertext, alice_secret) = alice(pk);
let bob_secret = bob(sk, ciphertext.as_bytes());
assert_eq!(alice_secret, bob_secret);
}
This library and binary wrapper is offered as-is, and without a guarantee. Please exercise caution when using this library in a production application, and we accept no liability for any security issues related to the use of this code.
- Roberto Avanzi, ARM Limited (DE)
- Joppe Bos, NXP Semiconductors (BE)
- Léo Ducas, CWI Amsterdam (NL)
- Eike Kiltz, Ruhr University Bochum (DE)
- Tancrède Lepoint, SRI International (US)
- Vadim Lyubashevsky, IBM Research Zurich (CH)
- John M. Schanck, University of Waterloo (CA)
- Peter Schwabe, MPI-SP (DE) & Radboud University (NL)
- Gregor Seiler, IBM Research Zurich (CH)
- Damien Stehle, ENS Lyon (FR)