The lol package

[Tags:gpl, library]

Λ ∘ λ (Lol) is a general-purpose library for ring-based lattice cryptography. For a detailed description of interfaces and functionality, see Λ ∘ λ: Functional Lattice Cryptography. Backends for the library include lol-cpp and lol-repa. For example cryptographic applications, see lol-apps.

[Skip to Readme]


Versions,,,,,,,,, (info)
Change log
Dependencies arithmoi (>= && <0.5), base (>=4.9 && <5), bytestring (<0.11), constraints (<0.10), containers (>= && <0.6), crypto-api (<0.14), data-default (>=0.3.0 && <0.8), deepseq (>= && <1.5), directory (<1.4), monadcryptorandom (<0.8), MonadRandom (>=0.2 && <0.6), mtl (>=2.2.1 && <2.3), numeric-prelude (>=0.4.2 && <0.5), protocol-buffers (<2.5), protocol-buffers-descriptor (<2.5), random (==1.1.*), reflection (>=1.5.1 && <2.2), singletons (>= && <2.3), tagged-transformer (>=0.7 && <0.9), template-haskell (>= && <2.12), vector (>=0.11 && <0.13), vector-th-unbox (>= && <0.3) [details]
License GPL-2
Copyright Eric Crockett, Chris Peikert
Author Eric Crockett <>, Chris Peikert <>
Maintainer Eric Crockett <>
Stability experimental
Category Crypto
Home page
Bug tracker
Source repository head: git clone
Uploaded Sun Feb 19 02:27:15 UTC 2017 by crockeea
Updated Thu Feb 23 05:47:08 UTC 2017 by crockeea to revision 1
Distributions NixOS:
Downloads 381 total (81 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2017-02-19 [all 1 reports]




llvmCompile via LLVM. This produces much better object code, but you need to have the LLVM compiler installed.DisabledAutomatic
optTurn on library optimizationsEnabledAutomatic

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


Maintainer's Corner

For package maintainers and hackage trustees

Readme for lol

Readme for lol-

This package is primarily a library providing interfaces for lattice cryptography
primitives. There are two main interfaces: 'Cyclotomic' and 'Tensor'. The
Cyclotomic interface is the outward-facing API that is used to build cryptographic
applications like pseudo-random functions, encryption, etc. The Tensor interface allows
multiple backends to implement the functionality used by the Cyclotomic interface.
Unless you are writing a new backend implementation, you shouldn't 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 be used by most

For a brief introduction to relevant mathematical notation, see 'Crypto.Lol'.

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

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

Tensor layer:
* 'Crypto.Lol.Cyclotomic.Tensor', which defines a class that encapsulates 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.
  Two implementations can be found at
  < lol-cpp>
  and < lol-repa>.

Base ring layer:
* 'Crypto.Lol.Types.FiniteField', which gives an unoptimized implementation of
  finite field arithmetic. To use this module, you will need an instance of
  'IrreduciblePoly'. These instances provide 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 'IrreducibleChar2'.

* '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 integers back to the code..
  'Factored' types are mainly used to represent cyclotomic indices.

Tests and benchmarks can be found in the packages < lol-tests> and < lol-benches>,
respectively, though they are instantiated in individual tensors.