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