Expand description
Pure Rust implementation of Streamlined NTRU Prime KEM for all parameter sizes.
Streamlined NTRU Prime is a lattice-based, quantum-resistant cryptographic algorithm designed for secure key exchange. This crate supports all six parameter sets: sntrup653, sntrup761, sntrup857, sntrup953, sntrup1013, and sntrup1277.
§Usage
use sntrup::{Sntrup761, SntrupKem};
let mut rng = rand::rng();
let (ek, dk) = Sntrup761::generate_key(&mut rng);
let (ct, ss1) = ek.encapsulate(&mut rng);
let ss2 = dk.decapsulate(&ct);
assert_eq!(ss1, ss2);§Security Levels
Sntrup653/sntrup653: NIST Level 1 (128-bit security) — research/testing only, preferSntrup761or higher for productionSntrup761/sntrup761: NIST Level 2 (128-bit+ security, used by OpenSSH)Sntrup857/sntrup857: NIST Level 3 (192-bit security)Sntrup953/sntrup953: NIST Level 4 (192-bit+ security)Sntrup1013/sntrup1013: NIST Level 5 (256-bit security)Sntrup1277/sntrup1277: NIST Level 5 (256-bit security, with extra margin)
§Sizes (bytes)
| Parameter Set | NIST Level | Public Key | Secret Key | Ciphertext | Shared Secret |
|---|---|---|---|---|---|
| sntrup653 | 1 | 994 | 1518 | 897 | 32 |
| sntrup761 | 2 | 1158 | 1763 | 1039 | 32 |
| sntrup857 | 3 | 1322 | 1999 | 1184 | 32 |
| sntrup953 | 4 | 1505 | 2254 | 1349 | 32 |
| sntrup1013 | 5 | 1623 | 2417 | 1455 | 32 |
| sntrup1277 | 5 | 2067 | 3059 | 1847 | 32 |
§Features
kgen: Key generation (default)ecap: Encapsulation (default)dcap: Decapsulation (default)serde: Serde serialization support viaserdect
Modules§
- sntrup653
- sntrup653: NIST Level 1 (128-bit security), p=653, q=4621, w=288.
- sntrup761
- sntrup761: NIST Level 2 (128-bit+ security), p=761, q=4591, w=286. Used by OpenSSH.
- sntrup857
- sntrup857: NIST Level 3 (192-bit security), p=857, q=5167, w=322.
- sntrup953
- sntrup953: NIST Level 4 (192-bit+ security), p=953, q=6343, w=396.
- sntrup1013
- sntrup1013: NIST Level 5 (256-bit security), p=1013, q=7177, w=448.
- sntrup1277
- sntrup1277: NIST Level 5 (256-bit security, extra margin), p=1277, q=7879, w=492.
Structs§
- Ciphertext
- Streamlined NTRU Prime ciphertext.
- Decapsulation
Key - Streamlined NTRU Prime decapsulation key (secret key).
- Encapsulation
Key - Streamlined NTRU Prime encapsulation key (public key).
- Shared
Secret - Streamlined NTRU Prime shared secret.
- Sntrup653
Params - sntrup653 parameter marker (NIST Level 1, 128-bit security).
- Sntrup761
Params - sntrup761 parameter marker (NIST Level 2, 128-bit+ security).
- Sntrup857
Params - sntrup857 parameter marker (NIST Level 3, 192-bit security).
- Sntrup953
Params - sntrup953 parameter marker (NIST Level 4, 192-bit+ security).
- Sntrup1013
Params - sntrup1013 parameter marker (NIST Level 5, 256-bit security).
- Sntrup1277
Params - sntrup1277 parameter marker (NIST Level 5, 256-bit security).
- Sntrup
Kem - Streamlined NTRU Prime Key Encapsulation Mechanism parameterized by parameter set.
Enums§
- Error
- Errors returned by sntrup operations.
Traits§
- Sntrup
Params - Trait defining a Streamlined NTRU Prime parameter set.
Type Aliases§
- Sntrup653
- sntrup653 KEM (NIST Level 1, 128-bit security).
- Sntrup761
- sntrup761 KEM (NIST Level 2, 128-bit+ security, used by OpenSSH).
- Sntrup857
- sntrup857 KEM (NIST Level 3, 192-bit security).
- Sntrup953
- sntrup953 KEM (NIST Level 4, 192-bit+ security).
- Sntrup1013
- sntrup1013 KEM (NIST Level 5, 256-bit security).
- Sntrup1277
- sntrup1277 KEM (NIST Level 5, 256-bit security).