Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Common Utility Functions

The qfall-tools crate includes a suite of standard algorithms and shorthands designed to streamline prototyping. We document them here to ensure you don’t reinvent the wheel – utilizing these reviewed and tested implementations allows you to focus on high-level prototyping rather than boilerplate code.

You can find these utilities in the qfall_tools::utils module:

  • common_encodings: Encodes any integer into a PolynomialRingZq s.t. each coefficient encodes at most one value in \([0,p)\), which is spread by a factor of \(q/p\). Thus, this function mimics the behavior of \(\lfloor \frac{q}{p} \cdot \mu \rfloor\) for an encoded message \(\mu \in \mathcal{R}_p\), which is often used in lattice-based public-key encryption schemes.
  • common_moduli: Provides helper functions new_cyclic and new_anticyclic to create ModulusPolynomialRingZq instances for \( X^n - 1 \bmod q \) and \( X^n + 1 \bmod q \) respectively.
  • rotation_matrix: Contains functions to generate rotation matrices that can serve as bases for structured lattices (specifically for anti-cyclic lattices).

Note: This list is not frequently updated. So, please check qfall_tools::utils for updates and further details.