falcon_rust/
lib.rs

1//! Unofficial rust implementation of the [Falcon] post-quantum
2//! digital signature scheme.
3//!
4//! Falcon was submitted to the [NIST PQC]
5//! standardization project and was [selected] for
6//! standardization. The final standard is still outstanding. We do anticipate slight changes
7//! between the standard and the submission, and these changes might break compatibility.
8//!
9//! Falcon comes in two variants. Falcon512 claims at least 108 bits of security, and
10//! Falcon1024 claims at least 252 bits of security, both against quantum computers.
11//!
12//! This implementation was written following the [specification]
13//! and using the [python implementation] as a guide, although later versions diverge from this
14//! reference point.
15//!
16//! [Falcon]: https://falcon-sign.info/
17//! [NIST PQC]: https://csrc.nist.gov/projects/post-quantum-cryptography
18//! [selected]: https://csrc.nist.gov/Projects/post-quantum-cryptography/selected-algorithms-2022
19//! [specification]: https://falcon-sign.info/falcon.pdf
20//! [python implementation]: https://github.com/tprest/falcon.py
21//!
22//! # Usage
23//!
24//! First, `falcon-rust = "0.1.2"` to your `Cargo.toml` file.
25//!
26//! Then to use the interface:
27//! ```
28//! use falcon_rust::falcon512;
29//!
30//! use rand::thread_rng;
31//! use rand::Rng;
32//!
33//! let msg = b"Hello, world!";
34//! let (sk, pk) = falcon512::keygen(thread_rng().gen());
35//! let sig = falcon512::sign(msg, &sk);
36//! assert!(falcon512::verify(msg, &sig, &pk));
37//! ```
38//!
39//! For serialization / deserialization:
40//! ```
41//! use falcon_rust::falcon512;
42//!
43//! use rand::thread_rng;
44//! use rand::Rng;
45//!
46//! let msg = b"Hello, world!";
47//! let (sk, pk) = falcon512::keygen(thread_rng().gen());
48//! let sig = falcon512::sign(msg, &sk);
49//!
50//! let sk_buffer = sk.to_bytes();
51//! let pk_buffer = pk.to_bytes();
52//! let sig_buffer = sig.to_bytes();
53//! falcon512::SecretKey::from_bytes(&sk_buffer);
54//! falcon512::PublicKey::from_bytes(&pk_buffer);
55//! falcon512::Signature::from_bytes(&sig_buffer);
56//! ```
57
58pub(crate) mod cyclotomic_fourier;
59pub(crate) mod encoding;
60pub(crate) mod falcon;
61pub mod falcon1024;
62pub mod falcon512;
63pub(crate) mod fast_fft;
64pub(crate) mod ffsampling;
65pub(crate) mod field;
66pub(crate) mod inverse;
67pub(crate) mod math;
68pub(crate) mod polynomial;
69pub(crate) mod samplerz;