rust_sike/
lib.rs

1//! This is documentation for the `rust-sike` crate.
2//!
3//! # Introduction
4//! `rust-sike` is an implementation of the supersingular isogeny primitives for SIKE, a post-quantum
5//! candidate submitted to NIST for standardization.
6//!
7//! This crate provides public-key encryption (`PKE`) and key encapsulation (`KEM`).
8//!
9//! # Examples
10//!
11//! ```rust
12//! use rust_sike::{self, KEM};
13//! let params = rust_sike::sike_p434_params(None, None);
14//!
15//! let kem = KEM::setup(params);
16//!
17//! // Alice runs keygen, publishes pk3. Values s and sk3 are secret
18//! let (s, sk3, pk3) = kem.keygen();
19//!
20//! // Bob uses pk3 to derive a key k and encapsulation c
21//! let (c, k) = kem.encaps(&pk3);
22//!
23//! // Bob sends c to Alice
24//! // Alice uses s, c, sk3 and pk3 to recover k
25//! let k_recovered = kem.decaps(&s, &sk3, &pk3, c);
26//!
27//! assert_eq!(k, k_recovered);
28//! ```
29
30#![warn(missing_docs)]
31#![deny(clippy::mem_forget)]
32#[forbid(unsafe_code)]
33mod constants;
34mod ff;
35mod isogeny;
36mod utils;
37
38pub mod kem;
39pub mod pke;
40pub use {kem::KEM, pke::PKE};
41
42pub use utils::strategy::{
43    compute_strategy, P434_THREE_TORSION_STRATEGY, P434_TWO_TORSION_STRATEGY,
44    P503_THREE_TORSION_STRATEGY, P503_TWO_TORSION_STRATEGY, P610_THREE_TORSION_STRATEGY,
45    P610_TWO_TORSION_STRATEGY, P751_THREE_TORSION_STRATEGY, P751_TWO_TORSION_STRATEGY,
46};
47
48pub use crate::{
49    isogeny::{sike_p434_params, sike_p503_params, sike_p610_params, sike_p751_params},
50    utils::strategy,
51};