qfall_tools/lib.rs
1// Copyright © 2023 Niklas Siemer, Marvin Beckmann
2//
3// This file is part of qFALL-tools.
4//
5// qFALL-tools is free software: you can redistribute it and/or modify it under
6// the terms of the Mozilla Public License Version 2.0 as published by the
7// Mozilla Foundation. See <https://mozilla.org/en-US/MPL/2.0/>.
8
9//! `qFALL` is a prototyping library for lattice-based cryptography.
10//! `qFALL-tools` collects common sub-modules and features used by lattice-based constructions
11//! to simplify and accelerate the development of such.
12//! Among these are:
13//! - [Compression techniques](crate::compression),
14//! - [Primitives such as Preimage Samplable Functions (PSF)](crate::primitive),
15//! - [Sampling algorithm using trapdoors](crate::sample), and
16//! - [common functions for efficient prototyping](crate::utils) such as
17//! - [common message encodings for encryption](crate::utils::common_encodings),
18//! - [quick instantiations of common moduli for rings](crate::utils::common_moduli), as well as
19//! - [rotation matrices](crate::utils::rotation_matrix).
20//!
21//! The `qFALL` project contains two more crates called [`qFALL-math`](https://crates.io/crates/qfall-math)
22//! and [`qFALL-schemes`](https://crates.io/crates/qfall-schemes) to support prototyping.
23//! - Find further information on [our website](https://qfall.github.io/).
24//! - We recommend [our tutorial](https://qfall.github.io/book) to start working with qFALL.
25//!
26//! ## Quick Example
27//! ```
28//! use qfall_tools::utils::{common_moduli::new_anticyclic, common_encodings::encode_value_in_polynomialringzq};
29//! use qfall_math::integer::Z;
30//!
31//! // Create X^256 + 1 mod 3329
32//! let poly_mod = new_anticyclic(256, 3329).unwrap();
33//! // Generate integer from string
34//! let message = Z::from_utf8("Hello!");
35//! // Turn string into encoding q/2 and 0 for each 1 and 0 bit respectively
36//! let mu_q_half = encode_value_in_polynomialringzq(message, 2, &poly_mod).unwrap();
37//! ```
38
39pub mod compression;
40pub mod primitive;
41pub mod sample;
42pub mod utils;