qfall_schemes/lib.rs
1// Copyright © 2023 Niklas Siemer, Marvin Beckmann
2//
3// This file is part of qFALL-schemes.
4//
5// qFALL-schemes 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-schemes` collects prototype implementations of lattice-based cryptography
11//! s.t. anyone can audit, modify, extend, or build on top of them to prototype more involved constructions or protocols.
12//! Among these are traits and implemented constructions of:
13//! - [Public-Key Encryption schemes](pk_encryption) implementations such as [Regev's Encryption](pk_encryption::Regev), [its dual version](pk_encryption::DualRegev), [LPR](pk_encryption::LPR), or [K-PKE](pk_encryption::KPKE),
14//! - [Signature schemes](signature) implementations such as GPV-based [FDH](signature::fdh) or [PFDH](signature::fdh),
15//! - an [Identity-based Encryption](identity_based_encryption) from [Dual Regev](identity_based_encryption::DualRegevIBE), as well as
16//! - [Hash functions](hash) such as the [SIS hash](hash::SISHash) or a [SHA256-based hash](hash::sha256).
17//!
18//! The `qFALL` project contains two more crates called [`qFALL-math`](https://crates.io/crates/qfall-math)
19//! and [`qFALL-tools`](https://crates.io/crates/qfall-tools) to support prototyping.
20//! - Find further information on [our website](https://qfall.github.io/).
21//! - We recommend [our tutorial](https://qfall.github.io/book) to start working with qFALL.
22//!
23//! ## Quick Example
24//! ```
25//! use qfall_schemes::pk_encryption::{KPKE, PKEncryptionScheme};
26//! use qfall_math::integer::Z;
27//!
28//! // setup public parameters
29//! let k_pke = KPKE::ml_kem_512();
30//!
31//! // generate (pk, sk) pair
32//! let (pk, sk) = k_pke.key_gen();
33//!
34//! // encrypt a message
35//! let msg = Z::from_utf8("Hello");
36//! let cipher = k_pke.enc(&pk, &msg);
37//!
38//! // decrypt the ciphertext
39//! let m = k_pke.dec(&sk, &cipher);
40//!
41//! assert_eq!(msg, m);
42//! ```
43
44pub mod hash;
45pub mod identity_based_encryption;
46pub mod pk_encryption;
47pub mod signature;