lattice

module
v5.0.0-...-72ea290 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: Apache-2.0

README

lattice

Lattice-based multiparty homomorphic encryption library in Go

Go tests

Lattice is a Go module that implements full-RNS Ring-Learning-With-Errors-based homomorphic-encryption primitives and Multiparty-Homomorphic-Encryption-based secure protocols. The library features:

  • Optimized arithmetic for power-of-two cyclotomic rings.
  • Advanced and scheme-agnostic implementation of RLWE-based primitives, key-generation, and their multiparty version.
  • Implementation of the BFV/BGV and CKKS schemes and their multiparty version.
  • Support for RGSW, external product and LMKCDEY blind rotations.
  • A pure Go implementation, enabling cross-platform builds, including WASM compilation for browser clients, with comparable performance to state-of-the-art C++ libraries.

Lattice is meant to support HE in distributed systems and microservices architectures, for which Go is a common choice thanks to its natural concurrency model and portability.

Library overview

The library exposes the following packages:

  • lattice/he: The main package of the library which provides scheme-agnostic interfaces and Homomorphic Encryption for different plaintext domains.

    • hebin: Homomorphic Encryption for binary arithmetic. It comprises blind rotations (a.k.a Lookup Tables) over RLWE ciphertexts.

    • hefloat: Homomorphic Encryption for fixed-point approximate arithmetic over the complex or real numbers.

      • bootstrapper: Bootstrapping for fixed-point approximate arithmetic over the real and complex numbers, with support for the Conjugate Invariant ring, batch bootstrapping with automatic packing/unpacking of sparsely packed/smaller ring degree ciphertexts, arbitrary precision bootstrapping, and advanced circuit customization/parameterization.
    • heint: Homomorphic Encryption for modular arithmetic over the integers.

  • lattice/mhe: Package for multiparty (a.k.a. distributed or threshold) key-generation and interactive ciphertext bootstrapping with secret-shared secret keys.

    • mhefloat: Homomorphic decryption and re-encryption from and to Linear-Secret-Sharing-Shares, as well as interactive ciphertext bootstrapping for the package he/hefloat.

    • mheint: Homomorphic decryption and re-encryption from and to Linear-Secret-Sharing-Shares, as well as interactive ciphertext bootstrapping for the package he/heint.

  • lattice/schemes: A package implementing RLWE-based homomorphic encryption schemes.

    • bfv: A Full-RNS variant of the Brakerski-Fan-Vercauteren scale-invariant homomorphic encryption scheme. This scheme is instantiated via a wrapper of the bgv scheme. It provides modular arithmetic over the integers.

    • bgv: A Full-RNS generalization of the Brakerski-Fan-Vercauteren scale-invariant (BFV) and Brakerski-Gentry-Vaikuntanathan (BGV) homomorphic encryption schemes. It provides modular arithmetic over the integers.

    • ckks: A Full-RNS Homomorphic Encryption for Arithmetic for Approximate Numbers (HEAAN, a.k.a. CKKS) scheme. It provides fixed-point approximate arithmetic over the complex numbers (in its classic variant) and over the real numbers (in its conjugate-invariant variant).

  • lattice/core: A package implementing the core cryptographic functionalities of the library.

    • rlwe: Common base for generic RLWE-based homomorphic encryption. It provides all homomorphic functionalities and defines all structs that are not scheme-specific. This includes plaintext, ciphertext, key-generation, encryption, decryption and key-switching, as well as other more advanced primitives such as RLWE-repacking.

    • rgsw: A Full-RNS variant of Ring-GSW ciphertexts and the external product.

  • lattice/ring: Modular arithmetic operations for polynomials in the RNS basis, including: RNS basis extension; RNS rescaling; number theoretic transform (NTT); uniform, Gaussian and ternary sampling.

  • lattice/examples: Executable Go programs that demonstrate the use of the Lattice library. Each subpackage includes test files that further demonstrate the use of Lattice primitives.

  • lattice/utils: Generic utility methods. This package also contains the following sub-pacakges:

    • bignum: Arbitrary precision linear algebra and polynomial approximation.
    • buffer: Efficient methods to write/read on io.Writer and io.Reader.
    • factorization: Various factorization algorithms for medium-sized integers.
    • sampling: Secure bytes sampling.
    • structs: Generic structs for maps, vectors and matrices, including serialization.
---
title: Packages Dependency & Organization
---
flowchart LR
RING(RING) --> RLWE(RLWE)
RLWE --> RGSW(RGSW)
RLWE --> HE([HE])
RLWE --> CKKS{{CKKS}}
RGSW --> HEBin{HEBin}
HE --> HEFloat{HEFloat}
HE --> HEInt{HEInt}
BFV/BGV --> HEInt
CKKS --> HEFloat
RLWE --> BFV/BGV{{BFV/BGV}}
MHE --> MHEFloat
HEFloat --> MHEFloat((MHEFloat))
HEFloat --> Bootstrapping
HEInt --> MHEInt((MHEInt))
RLWE --> MHE([MHE])
MHE --> MHEInt

Versions and Roadmap

The Lattice library was originally exclusively developed by the EPFL Laboratory for Data Security until its version 2.4.0.

Starting with the release of version 3.0.0, Lattice is maintained and supported by Tune Insight SA.

Also starting with from version 3.0.0, the module name has changed to github.com/luxdefi/lattice/v[X], and the official repository has been moved to https://github.com/luxdefi/lattice. This has the following implications for modules that depend on Lattice:

  • Modules that require github.com/ldsec/lattice/v2 will still build correctly.
  • To upgrade to a version X.y.z >= 3.0.0, depending modules must require github.com/luxdefi/lattice/v[X]/, for example by changing the imports to github.com/luxdefi/lattice/v[X]/[package] and by running go mod tidy.

The current version of Lattice, (v4.x.x) is fast-evolving and in constant development. Consequently, there will still be backward-incompatible changes within this major version, in addition to many bug fixes and new features. Hence, we encourage all Lattice users to update to the latest Lattice version.

See CHANGELOG.md for the current and past versions.

Stability

To keep a comprehensive history, we prioritize rebases over merges for branches other than main. Branches with the prefix dev_ are branches in active development and will be frequently rebased. Hence, we don't recommend depending on them.

Pull Requests

External pull requests should only be used to propose new functionalities that are substantial and would require a fair amount of work if done on our side. If you plan to open such a pull request, please contact us before doing so to make sure that the proposed changes are aligned with our development roadmap.

External pull requests only proposing small or trivial changes will be converted to an issue and closed.

License

Lattice is licensed under the Apache 2.0 License. See LICENSE.

Contact

Before contacting us directly, please make sure that your request cannot be handled through an issue.

If you want to contribute to Lattice, have a feature proposal or request, to report a security issue or simply want to contact us directly, please do so using the following email: lattice@luxdefi.com.

Citing

Please use the following BibTex entry for citing Lattice:

@misc{lattice,
    title = {Lattice v5},
    howpublished = {Online: \url{https://github.com/luxdefi/lattice}},
    month = Nov,
    year = 2023,
    note = {EPFL-LDS, Tune Insight SA}
}

The Lattice logo is a lattice-based version of the original Golang mascot by Renee French.

Directories

Path Synopsis
core
rgsw
Package rgsw implements an RLWE-based GSW encryption and external product RLWE x RGSW -> RLWE.
Package rgsw implements an RLWE-based GSW encryption and external product RLWE x RGSW -> RLWE.
rlwe
Package rlwe implements the generic cryptographic functionalities and operations that are common to R-LWE schemes.
Package rlwe implements the generic cryptographic functionalities and operations that are common to R-LWE schemes.
Package examples contains several example Go applications that use Lattice in both the single- and multiparty settings, as well as several example parameter sets.
Package examples contains several example Go applications that use Lattice in both the single- and multiparty settings, as well as several example parameter sets.
single_party/applications/bin_blind_rotations
Package main implements an example of Blind Rotation (a.k.a.
Package main implements an example of Blind Rotation (a.k.a.
single_party/applications/reals_bootstrapping/basics
Package main implements an example showcasing the basics of the bootstrapping for fixed-point approximate arithmetic over the reals/complexes.
Package main implements an example showcasing the basics of the bootstrapping for fixed-point approximate arithmetic over the reals/complexes.
single_party/applications/reals_bootstrapping/high_precision
Package main implements an example showcasing high-precision bootstrapping for high-precision fixed- point approximate arithmetic over the reals/complexes.
Package main implements an example showcasing high-precision bootstrapping for high-precision fixed- point approximate arithmetic over the reals/complexes.
single_party/applications/reals_bootstrapping/slim
Package main implements an example showcasing slim for bootstrapping for fixed-point approximate arithmetic over the reals/complexes numbers.
Package main implements an example showcasing slim for bootstrapping for fixed-point approximate arithmetic over the reals/complexes numbers.
single_party/applications/reals_scheme_switching
Package main showcases how lookup tables can complement fixed-point approximate homomorphic encryption to compute non-linear functions such as sign.
Package main showcases how lookup tables can complement fixed-point approximate homomorphic encryption to compute non-linear functions such as sign.
single_party/applications/reals_sigmoid_chebyshev
Package main implements an example of smooth function approximation using Chebyshev polynomial interpolation.
Package main implements an example of smooth function approximation using Chebyshev polynomial interpolation.
single_party/applications/reals_sigmoid_minimax
Package main implements an example of smooth function approximation using minimax polynomial interpolation.
Package main implements an example of smooth function approximation using minimax polynomial interpolation.
single_party/applications/reals_vectorized_polynomial_evaluation
Package main implements an example of vectorized polynomial evaluation.
Package main implements an example of vectorized polynomial evaluation.
single_party/templates/int
Package main is a template encrypted modular arithmetic integers, with a set of example parameters, key generation, encoding, encryption, decryption and decoding.
Package main is a template encrypted modular arithmetic integers, with a set of example parameters, key generation, encoding, encryption, decryption and decoding.
single_party/templates/reals
Package main is a template encrypted arithmetic with floating point values, with a set of example parameters, key generation, encoding, encryption, decryption and decoding.
Package main is a template encrypted arithmetic with floating point values, with a set of example parameters, key generation, encoding, encryption, decryption and decoding.
he
Package he implements scheme agnostic functionalities for RLWE-based Homomorphic Encryption schemes implemented in Lattice.
Package he implements scheme agnostic functionalities for RLWE-based Homomorphic Encryption schemes implemented in Lattice.
hebin
Package hebin implements blind rotations evaluation for RLWE schemes.
Package hebin implements blind rotations evaluation for RLWE schemes.
hefloat
Package hefloat implements Homomorphic Encryption with fixed-point approximate arithmetic over the complex or real numbers.
Package hefloat implements Homomorphic Encryption with fixed-point approximate arithmetic over the complex or real numbers.
hefloat/bootstrapping
Package bootstrapping implements bootstrapping for fixed-point encrypted approximate homomorphic encryption over the complex/real numbers.
Package bootstrapping implements bootstrapping for fixed-point encrypted approximate homomorphic encryption over the complex/real numbers.
hefloat/cosine
Package cosine method is the Go implementation of the polynomial-approximation algorithm by Han and Ki in
Package cosine method is the Go implementation of the polynomial-approximation algorithm by Han and Ki in
heint
Package heint implements Homomorphic Encryption for encrypted modular arithmetic over the integers.
Package heint implements Homomorphic Encryption for encrypted modular arithmetic over the integers.
mhe
Package mhe implements RLWE-based scheme agnostic multiparty key-generation and proxy re-rencryption.
Package mhe implements RLWE-based scheme agnostic multiparty key-generation and proxy re-rencryption.
mhefloat
Package mhefloat implements homomorphic decryption to Linear-Secret-Shared-Shares (LSSS) and homomorphic re-encryption from LSSS, as well as interactive bootstrapping for the package `he/hefloat` See `mhe/README.md` for additional information on multiparty schemes.
Package mhefloat implements homomorphic decryption to Linear-Secret-Shared-Shares (LSSS) and homomorphic re-encryption from LSSS, as well as interactive bootstrapping for the package `he/hefloat` See `mhe/README.md` for additional information on multiparty schemes.
mheint
Package mheint implements homomorphic decryption to Linear-Secret-Shared-Shares (LSSS) and homomorphic re-encryption from LSSS, as well as interactive bootstrapping for the package `he/heint` See `mhe/README.md` for additional information on multiparty schemes.
Package mheint implements homomorphic decryption to Linear-Secret-Shared-Shares (LSSS) and homomorphic re-encryption from LSSS, as well as interactive bootstrapping for the package `he/heint` See `mhe/README.md` for additional information on multiparty schemes.
Package ring implements RNS-accelerated modular arithmetic operations for polynomials, including: RNS basis extension; RNS rescaling; number theoretic transform (NTT); uniform, Gaussian and ternary sampling.
Package ring implements RNS-accelerated modular arithmetic operations for polynomials, including: RNS basis extension; RNS rescaling; number theoretic transform (NTT); uniform, Gaussian and ternary sampling.
ringqp
Package ringqp is implements a wrapper for both the ringQ and ringP.
Package ringqp is implements a wrapper for both the ringQ and ringP.
schemes
bfv
Package bfv provides an RNS-accelerated implementation of the Fan-Vercauteren version of Brakerski's (BFV) scale-invariant homomorphic encryption scheme.
Package bfv provides an RNS-accelerated implementation of the Fan-Vercauteren version of Brakerski's (BFV) scale-invariant homomorphic encryption scheme.
bgv
Package bgv implements a unified RNS-accelerated version of the Fan-Vercauteren version of the Brakerski's scale invariant homomorphic encryption scheme (BFV) and Brakerski-Gentry-Vaikuntanathan (BGV) homomorphic encryption scheme.
Package bgv implements a unified RNS-accelerated version of the Fan-Vercauteren version of the Brakerski's scale invariant homomorphic encryption scheme (BFV) and Brakerski-Gentry-Vaikuntanathan (BGV) homomorphic encryption scheme.
ckks
Package ckks implements a RNS-accelerated version of the Homomorphic Encryption for Arithmetic for Approximate Numbers (HEAAN, a.k.a.
Package ckks implements a RNS-accelerated version of the Homomorphic Encryption for Arithmetic for Approximate Numbers (HEAAN, a.k.a.
Package utils implements various helper functions.
Package utils implements various helper functions.
bignum
Package bignum implements arbitrary precision arithmetic for integers, reals and complex numbers.
Package bignum implements arbitrary precision arithmetic for integers, reals and complex numbers.
buffer
Package buffer implement methods for efficiently writing and reading values to and from io.Writer and io.Reader that also expose their internal buffers.
Package buffer implement methods for efficiently writing and reading values to and from io.Writer and io.Reader that also expose their internal buffers.
factorization
Package factorization implements various algorithms for efficient factoring integers of small to medium size.
Package factorization implements various algorithms for efficient factoring integers of small to medium size.
sampling
Package sampling implements secure sampling of bytes and integers.
Package sampling implements secure sampling of bytes and integers.
structs
Package structs implements helpers to generalize vectors and matrices of structs, as well as their serialization.
Package structs implements helpers to generalize vectors and matrices of structs, as well as their serialization.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL