diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aae274a5..1ba5f0c63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,39 @@ - # Changelog All notable changes to this library are documented in this file. -## UNRELEASED +## [6.0.0] - 05.08.2024 - Deprecated Go versions `1.18`, `1.19` and `1.20`. The minimum version is now `1.21`, due to the use of the slices of std library package. + - Removal of all slice utility functions in `utils/slices.go` that are provided in the standard library. +- Golang test cache is deleted before invoking the unit test suite via `make test`. +- Deletion of the `he` package and its abstraction layers for the BGV and CKKS, refocus of the library onto the scheme level, i.e., the `schemes` package. +- Extraction of the homomorphic circuits from the `he` into a new `circuits` package. + - Simplification of the API for several circuits: + - Removal of the circuit-specific evaluator interfaces, e.g., `EvaluatorForLinearTransformation`. These interfaces are replaced with a scheme-agnostic evaluator in `schemes/schemes.go` due to the refocus of the Lattigo towards the individual cryptosystems. + - The individual homomorphic circuits are organized by schemes, in other words in the packages `circuits/bgv`, `circuits/ckks` and `circuits/common` where the latter bundles scheme-generic functionalities of circuits common to all deriving schemes. +- Absorb the `bfv` package into the `bgv` package. +- Rename `mhe` into `multiparty`. +- Slot-wise permutations as part of the `LinearTransformation` circuits: + - Permutation are handled through `lintrans.Permutation` and `lintrans.PermutationMapping` that induce `lintrans.Diagonals` from which a regular linear transformation can be bootstrapped. +- New ring packing API: + - New packing evaluator: `rlwe.RingPackingEvaluator`: + - `NewRingPackingEvaluator(evk *RingPackingEvaluationKey)` + - `Extract(ct *rlwe.Ciphertext, idx []int, naive bool) (cts map[int]*rlwe.Ciphertext, err error)` + - `Repack(cts map[int]*rlwe.Ciphertext, naive bool) (ct *rlwe.Ciphertext, err error)` + - `Split(ctN, ctEvenNHalf, ctOddNHalf *rlwe.Ciphertext) (err error)` + - `Merge(ctEvenNHalf, ctOddNHalf, ctN *rlwe.Ciphertext) (err error)` + - `ShallowCopy() *RingPackingEvaluator` + - New packing evaluation key: + - `rlwe.RingPackingEvaluationKey` +- Streamlined unit test context generation to reduce boilerplate code duplication: + - `schemes/*/test_utils.go` to be reused in packages `schemes` and packages that depend on `schemes`. +- Introduction of the `lintrans.Parameters.LevelQ` and `lintrans.Parameters.LevelP` fields and the removal of the `lintrans.Parameters.Level` field. +- Optimizations: + - Reduce the number of masking operations in `rlwe.Evaluator.gadgetProductSinglePAndBitDecompLazy`. + - Reduce degree of relinearization key shares in `multiparty/keygen_relin.go`. +- Add `gosec` exception directive to weak randomness in unit tests. +- Fix various linter warnings. +- Various docstring formatting fixes and the addition of `godoc` links through the `[]` operator. +- Updated `README.md` with new package hierarchy figures `lattigo-hierachy.svg` and new issue policy. ## [5.0.0] - 15.11.2023 - Deprecated Go versions `1.14`, `1.15`, `1.16`, and `1.17`. The minimum version is now `1.18`, due to the required use of generics. diff --git a/circuits/bgv/lintrans/lintrans.go b/circuits/bgv/lintrans/lintrans.go index a34823ec8..93667a09f 100644 --- a/circuits/bgv/lintrans/lintrans.go +++ b/circuits/bgv/lintrans/lintrans.go @@ -1,3 +1,4 @@ +// Package lintrans implements homomorphic linear transformations for the BFV/BGV schemes. package lintrans import ( diff --git a/circuits/bgv/polynomial/polynomial.go b/circuits/bgv/polynomial/polynomial.go index 7bdd8d7bd..a7e9b9ee9 100644 --- a/circuits/bgv/polynomial/polynomial.go +++ b/circuits/bgv/polynomial/polynomial.go @@ -1,3 +1,4 @@ +// Package polynomial implements a homomorphic polynomial evaluator for the BFV/BGV schemes. package polynomial import ( diff --git a/circuits/bgv/polynomial/polynomial_evaluator.go b/circuits/bgv/polynomial/polynomial_evaluator.go index b8323589d..5c60f99e9 100644 --- a/circuits/bgv/polynomial/polynomial_evaluator.go +++ b/circuits/bgv/polynomial/polynomial_evaluator.go @@ -72,31 +72,6 @@ func (eval Evaluator) EvaluateFromPowerBasis(pb polynomial.PowerBasis, p interfa return eval.Evaluator.Evaluate(pb, phe, targetScale, 1, &simEvaluator{eval.Parameters, eval.InvariantTensoring}) } -// scaleInvariantEvaluator is a struct containing a [bfv.Evaluator] with scale invariant tensoring (BFV-style). -type scaleInvariantEvaluator struct { - *bgv.Evaluator -} - -func (polyEval scaleInvariantEvaluator) Mul(op0 *rlwe.Ciphertext, op1 rlwe.Operand, opOut *rlwe.Ciphertext) (err error) { - return polyEval.MulScaleInvariant(op0, op1, opOut) -} - -func (polyEval scaleInvariantEvaluator) MulRelin(op0 *rlwe.Ciphertext, op1 rlwe.Operand, opOut *rlwe.Ciphertext) (err error) { - return polyEval.Evaluator.MulRelinScaleInvariant(op0, op1, opOut) -} - -func (polyEval scaleInvariantEvaluator) MulNew(op0 *rlwe.Ciphertext, op1 rlwe.Operand) (opOut *rlwe.Ciphertext, err error) { - return polyEval.Evaluator.MulScaleInvariantNew(op0, op1) -} - -func (polyEval scaleInvariantEvaluator) MulRelinNew(op0 *rlwe.Ciphertext, op1 rlwe.Operand) (opOut *rlwe.Ciphertext, err error) { - return polyEval.Evaluator.MulRelinScaleInvariantNew(op0, op1) -} - -func (polyEval scaleInvariantEvaluator) Rescale(op0, op1 *rlwe.Ciphertext) (err error) { - return nil -} - // CoefficientGetter is a struct that implements the // [polynomial.CoefficientGetter][uint64] interface. type CoefficientGetter struct { diff --git a/circuits/ckks/bootstrapping/bootstrapper.go b/circuits/ckks/bootstrapping/bootstrapper.go index 53e3a0447..b9c1bffe7 100644 --- a/circuits/ckks/bootstrapping/bootstrapper.go +++ b/circuits/ckks/bootstrapping/bootstrapper.go @@ -1,3 +1,5 @@ +// Package bootstrapping implements bootstrapping for fixed-point encrypted +// approximate homomorphic encryption over the complex/real numbers (CKKS scheme). package bootstrapping import "github.com/tuneinsight/lattigo/v5/core/rlwe" diff --git a/circuits/ckks/comparison/comparison.go b/circuits/ckks/comparison/comparison.go index 1ad593a2b..8eb7a4f0a 100644 --- a/circuits/ckks/comparison/comparison.go +++ b/circuits/ckks/comparison/comparison.go @@ -1,3 +1,4 @@ +// Package comparison implements homomorphic comparisons for the CKKS scheme. package comparison import ( diff --git a/circuits/ckks/dft/dft.go b/circuits/ckks/dft/dft.go index a93db4d24..78da8bcca 100644 --- a/circuits/ckks/dft/dft.go +++ b/circuits/ckks/dft/dft.go @@ -1,3 +1,4 @@ +// Package dft implements a homomorphic DFT circuit for the CKKS scheme. package dft import ( diff --git a/circuits/ckks/inverse/inverse.go b/circuits/ckks/inverse/inverse.go index d2c7bf37e..7b22d956e 100644 --- a/circuits/ckks/inverse/inverse.go +++ b/circuits/ckks/inverse/inverse.go @@ -1,3 +1,4 @@ +// Package inverse implements a homomorphic inversion circuit for the CKKS scheme. package inverse import ( diff --git a/circuits/ckks/lintrans/lintrans.go b/circuits/ckks/lintrans/lintrans.go index 24e83fe61..738c79bdd 100644 --- a/circuits/ckks/lintrans/lintrans.go +++ b/circuits/ckks/lintrans/lintrans.go @@ -1,3 +1,4 @@ +// Package lintrans implements homomorphic linear transformations for the CKKS scheme. package lintrans import ( @@ -122,7 +123,7 @@ func Encode[T ckks.Float](ecd schemes.Encoder, diagonals Diagonals[T], allocated lintrans.LinearTransformation(allocated)) } -// // GaloisElements returns the list of Galois elements required to evaluate the linear transformation. +// GaloisElements returns the list of Galois elements required to evaluate the linear transformation. func GaloisElements(params rlwe.ParameterProvider, lt Parameters) (galEls []uint64) { return lintrans.GaloisElements(params, lt.DiagonalsIndexList, 1<. +// +// The algorithm was originally implemented in C++, available at +// +// https://github.com/DohyeongKi/better-homomorphic-sine-evaluation package cosine import (