Crate qfall_math

Crate qfall_math 

Source
Expand description

qFALL is a prototyping library for lattice-based cryptography. qFALL-math yields the mathematical foundation by providing an easy to use, high-level API based on FLINT as well as several additional features often used in lattice-based cryptography. At a high level, it provides the following classes of datatypes:

The qFALL project contains two more crates called qFALL-tools and qFALL-schemes to support prototyping.

§Quick Example

use qfall_math::{integer_mod_q::MatZq, integer::MatZ};

let (n, m, q) = (256, 1024, 3329);
let (center, sigma) = (0.0, 8.0);

let mat_a = MatZq::sample_uniform(n, m, q);
let vec_s = MatZ::sample_uniform(n, 1, 0, 2).unwrap();
let vec_e = MatZ::sample_discrete_gauss(m, 1, center, sigma).unwrap();

// SIS-Instance: t = A * e mod q
let vec_t = &mat_a * &vec_e;

// LWE-Instance: b^T = s^T * A + e^T mod q
let vec_b = vec_s.transpose() * mat_a + vec_e.transpose();

Modules§

error
Contains our central error enum for easy error propagation.
integer
Integer-based types with arbitrary length based on Z.
integer_mod_q
Types for residue classes over integers with arbitrary length based on Zq.
rational
Rational-based types based on Q.
traits
Definitions of traits implemented and used in this crate.
utils
Common functions useful across several datatypes and crates.