qFALL is a prototyping library for lattice-based cryptography.
This schemes-crate collects implementations of lattice-based constructions s.t. anyone can audit, modify, extend, or build on top of them to prototype more involved constructions or protocols.
First, ensure that you use a Unix-like distribution (Linux or MacOS). Setup WSL if you're using Windows. This is required due to this crate's dependency on FLINT.
Then, make sure your rustc --version is 1.85 or newer.
Furthermore, it's required that m4, a C-compiler such as gcc, and make are installed.
sudo apt-get install m4 gcc makeThen, add you can add this crate to your project by executing the following command.
cargo add qfall-schemes- Find further information on our website. Also check out
qfall-mathandqfall-tools. - Read the documentation of this crate.
- We recommend our tutorial to start working with qFALL.
qFALL-schemes collects prototype implementations of lattice-based constructions to audit, modify, extend, and reuse them more easily in more involved constructions or protocols.
List of prototypes
- Public Key Encryption
- LWE Encryption
- Dual LWE Encryption
- LPR Encryption
- Ring-based LPR Encryption
- K-PKE, which is the foundation of CRYSTALS-Kyber and ML-KEM
- CCA-secure Encryption
- Signatures
- Identity Based Encryption
- Hash Functions
Kyber's Public-Key Encryption
use qfall_schemes::pk_encryption::{KPKE, PKEncryptionScheme};
use qfall_math::integer::Z;
// setup public parameters
let k_pke = KPKE::ml_kem_512();
// generate (pk, sk) pair
let (pk, sk) = k_pke.key_gen();
// encrypt a message
let msg = Z::from_utf8("Hello");
let cipher = k_pke.enc(&pk, &msg);
// decrypt the ciphertext
let m = k_pke.dec(&sk, &cipher);
assert_eq!(msg, m);GPV-based Probabilistic Full-Domain Hash
use qfall_schemes::signature::{pfdh::PFDHGPV, SignatureScheme};
let mut pfdh = PFDHGPV::setup(4, 113, 17, 128);
let msg = "Hello World!";
let (pk, sk) = pfdh.key_gen();
let sigma = pfdh.sign(msg.clone(), &sk, &pk);
assert!(pfdh.vfy(msg.clone(), &sigma, &pk));As initial implementations of traits and prototypes can sometimes be optimized by changing the API, we give no API/interface stability guarantees for this crate.
We try to be mindful but we may reorganize code without warning in advance.
Therefore, it is recommended to fix the used version version = "=x.y.z" in your Cargo.toml.
Please report bugs through the GitHub issue tracker.
Contributors are:
- Marvin Beckmann
- Phil Milewski
- Jan Niklas Siemer
A few reasons to merge your prototype into qFALL-schemes.
- In case of API changes, a version update of Rust or adapted formatting requirements, prototypes in this crate be kept executable and up-to-date.
- qFALL may benefit from your contribution as most prototypes are built with some optimisation in mind. We may consider integrating your optimisation into
qfall-mathandqfall-tools. - We ensure that prototypes are properly formatted, modularised, and documented before merging s.t. prototypes yield a reusable resource to the community.
- Researchers and developers may benefit from the public exposure of their prototype (and the often associated paper).
See Contributing for details on how to contribute.
Please use the following bibtex entry to cite qFALL.
TODO: Update to eprint
This project is based on qfall-math and qfall-tools, which build on top of the C-based, optimised math-library FLINT. We utilise serde and serde_json to (de-)serialize objects to and from JSON. This crate relies on criterion for benchmarking purposes. An extensive list can be found in our Cargo.toml file.
This library is distributed under the Mozilla Public License Version 2.0. Permissions of this weak copyleft license are conditioned on making the source code of licensed files and modifications of those files available under the same license (or in certain cases, under one of the GNU licenses). Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work may be distributed under different terms and without source code for files added to the larger work.