Skip to main content

Crate sntrup

Crate sntrup 

Source
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

§Sizes (bytes)

Parameter SetNIST LevelPublic KeySecret KeyCiphertextShared Secret
sntrup6531994151889732
sntrup761211581763103932
sntrup857313221999118432
sntrup953415052254134932
sntrup1013516232417145532
sntrup1277520673059184732

§Features

  • kgen: Key generation (default)
  • ecap: Encapsulation (default)
  • dcap: Decapsulation (default)
  • serde: Serde serialization support via serdect

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.
DecapsulationKey
Streamlined NTRU Prime decapsulation key (secret key).
EncapsulationKey
Streamlined NTRU Prime encapsulation key (public key).
SharedSecret
Streamlined NTRU Prime shared secret.
Sntrup653Params
sntrup653 parameter marker (NIST Level 1, 128-bit security).
Sntrup761Params
sntrup761 parameter marker (NIST Level 2, 128-bit+ security).
Sntrup857Params
sntrup857 parameter marker (NIST Level 3, 192-bit security).
Sntrup953Params
sntrup953 parameter marker (NIST Level 4, 192-bit+ security).
Sntrup1013Params
sntrup1013 parameter marker (NIST Level 5, 256-bit security).
Sntrup1277Params
sntrup1277 parameter marker (NIST Level 5, 256-bit security).
SntrupKem
Streamlined NTRU Prime Key Encapsulation Mechanism parameterized by parameter set.

Enums§

Error
Errors returned by sntrup operations.

Traits§

SntrupParams
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).