lol: A library for lattice cryptography.

[ crypto, gpl, library ] [ Propose Tags ]

Λ ⚬ λ (Lol) is a general-purpose library for ring-based lattice cryptography. For a detailed description of interfaces and functionality, see Λ ⚬ λ: Functional Lattice Cryptography. The main backend for the library is lol-cpp (lol-repa is currently out of date). For example cryptographic applications, see lol-apps.

[Skip to Readme]


Automatic Flags

Compile via LLVM. This produces much better object code, but you need to have the LLVM compiler installed.


Turn on library optimizations


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,,,,,,,, (info)
Change log
Dependencies ansi-terminal (>=0.9.1 && <0.10.0), arithmoi (>=0.9.0 && <0.10), base (>=4.12.0 && <4.13), bytestring (>=0.10.8 && <0.11), constraints (>=0.10.1 && <0.11.0), containers (>=0.6.0 && <0.7), criterion (>=1.5.6 && <1.6), criterion-measurement (>=0.1.2 && <0.2), crypto-api (>=0.13.3 && <0.14), data-default (>=0.7.1 && <0.8), deepseq (>=1.4.4 && <1.5), directory (>=1.3.3 && <1.4), monadcryptorandom (>=0.7.2 && <0.8), MonadRandom (>=0.5.1 && <0.6), mtl (>=2.2.2 && <2.3), numeric-prelude (>=0.4.3 && <0.5), protocol-buffers (>=2.4.12 && <2.5), protocol-buffers-descriptor (>=2.4.12 && <2.5), QuickCheck (>=2.13.2 && <2.14), random (>=1.1 && <1.2), reflection (>=2.1.5 && <2.2), singletons (>=2.5.1 && <2.6), statistics (>=0.15.1 && <0.16), tagged-transformer (>=0.8.1 && <0.9), template-haskell (>=2.14.0 && <2.15), test-framework (>=0.8.2 && <0.9), test-framework-quickcheck2 (>=0.3.0 && <0.4), vector (>=0.12.0 && <0.13), vector-th-unbox (>=0.2.1 && <0.3) [details]
License GPL-3.0-only
Copyright Eric Crockett, Chris Peikert
Author Eric Crockett <>, Chris Peikert <>
Maintainer Eric Crockett <>, Chad Sharp <>
Category Crypto
Home page
Bug tracker
Source repo head: git clone
Uploaded by crossroads1112 at 2020-02-19T19:39:11Z
Reverse Dependencies 6 direct, 1 indirect [details]
Downloads 7660 total (24 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-02-19 [all 1 reports]

Readme for lol-

[back to package description]
This package is primarily a library providing high-level interfaces
for lattice cryptography primitives. There are two main collections of
interfaces: 'Cyclotomic' and 'Tensor'. The Cyclotomic interface can be
used to build cryptographic primitives like encryption, pseudorandom
functions, etc. The lower-level Tensor interface allows multiple
backends to implement the functionality used by the Cyclotomic
interface.  Unless you are writing a new backend implementation, you
do not need to understand the Tensor interface. However, you *will*
need an implementation of the Tensor interface in order to test,
benchmark, and run applications.

Most of the functionality in Lol is exported by two modules:

* 'Crypto.Lol' exports the primary *interfaces* of Lol.

* 'Crypto.Lol.Types' exports concrete types that would tend to be used
  by most instantiations.

For a brief introduction to the relevant mathematical notation, see

Overview of key modules, roughly from highest- to lowest-level:

Cyclotomic layer:

* 'Crypto.Lol.Cyclotomic.Cyc' defines an interface for using
  cyclotomic fields \( K \), rings \( R \), and quotient rings \(
  R_q=R/qR \); as well as many other commonly used operations, e.g.,
  converting between rings; reducing, lifting, and decomposing
  elements; modulus reduction/rounding; etc. 'Cyc' is a safe wrapper
  around the 'CycRep' type, which exposes some
  representation-dependent operations.  'CycRep' (and hence 'Cyc') is
  implemented using a generic 'Tensor' (described below).

Tensor layer:

* 'Crypto.Lol.Cyclotomic.Tensor' defines interfaces that encapsulate
  all the necessary linear transformations for operating on
  representations of \( R \)- and \( R_q \)-elements, e.g., the CRT
  transform, converting between the powerful and decoding bases,
  generating error terms, etc.

* You will need an implementation of the 'Tensor' interface in order
  to use Lol. The main up-to-date implementation is
  < lol-cpp>
  (< lol-repa> is out of

Base-ring layer:

* 'Crypto.Lol.Types.FiniteField' gives an unoptimized implementation
  of finite-field arithmetic. To use this module, you will need an
  instance of 'IrreduciblePoly', which provides irreducible
  polynomials for various degrees and base fields. One (orphan)
  instance is provided for characteristic-2 fields of size up to 2^128
  in 'Crypto.Lol.Types.IrreducibleChar2', and is exported by
  'Crypto.Lol.Types'.  If you need to use an unsupported finite field,
  define your own instance of 'IrreduciblePoly' and do **not** import

* 'Crypto.Lol.Types.Unsafe.ZqBasic', which is a basic implementation
  of \( \Z_q=\Z/q\Z \) arithmetic.

* 'Crypto.Lol.Factored', which contains type-level support code for
  factored integers. It also supports "reifying" 'Int's at runtime as
  static types and "reflecting" those types as integer
  values. 'Factored' types are mainly used to represent cyclotomic

A collection of polymorphic tests and benchmarks can be found in the
packages < lol-tests> and
< lol-benches>,
respectively. These tests should be (and are) instantiated for
specific 'Tensor' backends by the corresponding tensor packages.