Skip to content

Commit b363f5d

Browse files
committed
Applied changes
1 parent 4cce9a4 commit b363f5d

File tree

324 files changed

+34911
-32430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+34911
-32430
lines changed

.github/CHANGELOG.md

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Changelog
2+
All notable changes to this library are documented in this file.
3+
4+
## [0.0.1] - 24.06.2024
5+
6+
Changes affecting the entire library:
7+
- Refactored how polynomials and their derivative structs (e.g. ciphertexts and keys) are instantiated.
8+
They now all have the following methods:
9+
- `.FromBuffer` which allow to assign a new backing to the receiver from an `[]uint64` slice
10+
- `.BufferSize` which returns the minimum size of the `[]uint64` slice to provide to `.FromBuffer`
11+
- Calling `New<Something>` will internally call the two here above methods
12+
- Removed the package `ring/ringqp`: all instances of `RingQP` have been replaced
13+
by separate calls to `RingQ` and `RingP`. New associated structs have been designed
14+
to replace the old `ringqp.Poly` (see changes to the `ring` package)
15+
- Refactored all sampling (see changes to `utils/sampling`), improves related performance by a speedup factor of up to 2x
16+
- Replaced most instances of `[]*<object>` by `[]<object>`, for example `[]*big.Float -> []big.Float`
17+
- Optimized the buffers and their size of many objects.
18+
19+
- `he`:
20+
- Linear Transformations:
21+
- Generalized implementation of linear transformation such that package specific code (e.g. `heint` or `hefloat`) is not necessary anymore.
22+
- Significantly improved the search for the best giant step size, which is not anymore constrained to a power of two:
23+
- Added `OptimalLinearTransformationGiantStep` which replaces `FindBestBSGSRatio` and returns much more optimal values (not constrained to be a power of two anymore) that properly minimize the number of Galois elements.
24+
- Removed the `LogBSGSRatio` from the
25+
- `LinearTransformationParameters`:
26+
- Removed the `LogBSGSRatio` field.
27+
- Removed the `Naive` field.
28+
- Added the `GiantStep` field.
29+
- LinearTransformationParameters:
30+
- Added `GaloisElements`: returns the set of Galois elements necessary to evaluate the diagonalized matrix.
31+
- LinearTransformation:
32+
- Removed the ` LogBabyStepGianStepRatio` field
33+
- Removed the `N1` field.
34+
- Added the `GiantStep` field.
35+
- Diagonals (diagonalized matrix):
36+
- Added `Add`: add two diagonalized matrices together.
37+
- Added `Mul`: multiply ttwo diagonalized matrices together.
38+
- Added `Indexes`: returns the indexes of the non-zero diagonals of the diagonalized matrix.
39+
- Added `GaloisElements`: returns the set of Galois elements necessary to evaluate the diagonalized matrix.
40+
- Added `At`: returns a specific diagonal of the diagonalized matrix.
41+
- Added `Evaluate: evaluates the diagonalized matrix on a vector.
42+
- Permutation (permutation matrix):
43+
- Added `Indexes`: returns the indexes of the non-zero diagonals of the permutation.
44+
- Added `Diagonals`: returns the diagonalized matrix of the permutation.
45+
- Added `GaloisElements`: returns the set of Galois elements necessary to evaluate the permutation.
46+
- Improved relinearization patterns when evaluating a polynomial with the flag `lazy=true`
47+
- Polynomial Evaluation:
48+
- The output of polynomial evaluation is not rescaled anymore, enabling more optimal noise management.
49+
- Added `EncodedPolynomial` type, a pre-encoded `VectorPolynomial` into `rlwe.Plaintext`.
50+
- `PolynomialVector`:
51+
- Simplified the field `Mapping` which now takes a single slices as mapping, instead of a map of slices.
52+
- Added `Evaluate`.
53+
54+
- `heint`:
55+
- Added support for prime power plaintext modulus.
56+
- Merged `schemes/bgv/` into `heint`
57+
- Removed package specific code for linear transformations (this functionality now solely depends on the `he` package)
58+
59+
- `hefloat`:
60+
- Bootstrapping:
61+
- Fixed wrong returned `MinimumInputLevel`
62+
- Added API to estimate the failure probability:
63+
- `FailureProbability` returns PR[||I(X)|| > K].
64+
- `FindSuitableK` returns the smallest K satisfying PR[||I(X)|| > K] <= 2^{logfailure}.
65+
- `ModifiedIrwinHall` estimates PR[||I(X)|| > K]
66+
67+
- Evaluator:
68+
- Added `MatchScalesForMul`
69+
- InverseEvaluator:
70+
- Changed `log2Min` and `log2Max` to `Min` and `Max` respectively. This enables a more human friendly parameterization.
71+
- Added `InvSqrt`, which returns 1/sqrt(x) by Newton iterations. Contrary to the GoldschmidtDivision algorithm, it can be used to refine a value already close to the ideal value, enabling composition with polynomial approximation.
72+
- GoldschmidtDivision takes as operand the number of iterations instead of automatically estimating them.
73+
- IntervalNormalization uses one less level per iteration (2 instead of 3), and use one less bootstrapping per iteration if using the Conjugate Invariant ring.
74+
- Added affine transformation for EvalMod1
75+
- Merged `schemes/ckks` into `hefloat`
76+
- Removed package specific code for linear transformations (this functionality now solely depends on the `he` package)
77+
- Improved statistics, which now also display the standard deviation as well as the error statistics
78+
79+
- `hefloat/bootstrapping`:
80+
- Improved serialization support for `bootstrapping.ParametersLiteral`
81+
82+
- `mhe`:
83+
- General rework, uniformization and simplification of the API of all protocols.
84+
- Greatly reduced code and code complexity of all protocols:
85+
- Protocols use the `rlwe.Encryptor` instead of re-implementing encryption routines
86+
- Shares are now standardized using the new structs defined in the `ring` package
87+
- New non-interactive protocols:
88+
- `mhe.CircularCiphertextProtocol`: non-interactive generation of `RLWE(ms)`.
89+
- `mhe.CircularGadgetCiphertextProtocol`: non-interactive generation of `GRLWE(ms)`.
90+
- These two protocols enable a fully non-interactive setup for `heint`, `hefloat` and `hebin`.
91+
- Improved the interactive relinearization key gen protocol (https://eprint.iacr.org/2021/1085).
92+
- Added full support for deterministic share generation.
93+
94+
- `core`:
95+
- Removed `core`
96+
97+
- `rlwe`:
98+
- Moved out of `core`
99+
- Expanded the API of the `Encryptor` to support deterministic encryption and be able to perform key-switching
100+
- Added support for signed digit decomposition
101+
- Parameters can be specified with any combination of (`Q`, `LogQ`) and (`P`, `LogP`)
102+
- Added `NoiseCiphertext`, which returns the base 2 logarithm of the standard deviation of the
103+
residual noise in an `rlwe.Ciphertext`
104+
- Removed field `nbPi` in `DecomposeNTT`
105+
- Added [Optimizing HE operations via Level-aware Key-switching Framework](https://eprint.iacr.org/2023/1328)
106+
107+
- `rgsw`:
108+
- Moved out of `core`
109+
- Added support for `RGSWxRGSW` product
110+
- Added `.FromGadgetCiphertext` which produces an `rgsw.Ciphertext` from an `rlwe.GadgetCiphertext`
111+
- Added signed digit decomposition
112+
113+
- `schemes`:
114+
- `bfv`: removed
115+
- `bgv`: merged into `he/heint`
116+
- `ckks`: merged into `he/hefloat`
117+
118+
- `examples`:
119+
- Refactored all examples
120+
121+
- `ring`:
122+
- `Ring`:
123+
- Renamed `Ring` to `RNSRing` and `SubRing` to `Ring`
124+
- Renamed `Poly` to `RNSPoly` which is now a slice of `Poly` and added type `Poly`, a slice of `[]uint64`.
125+
- Greatly simplified struct `RNSRing` which is now simply `[]*Ring`.
126+
- Updated vectorized operations to accept slices that are not multiples of 8 (and not trigger buffer overflows).
127+
- Added `Modulus` which returns the modulus of the ring (`.AtLevel(level).Modulus()` replaces `.ModulusAtLevel[level]`).
128+
- Added `RescaleConstants` which returns the rescaling constant for a given level (`.RescaleConstants(level)` replaces `RescaleConstants[level]`).
129+
- Added `Concat` which returns the concatenation of two rings
130+
- Added `AddModuli` which returns an instance of a ring with additional moduli.
131+
- `BasisExtender`:
132+
- Removed and replaced by methods on the `RNSRing` type. Constants are now computed on the fly.
133+
- Refactored the samplers which now take a `sampling.Source` as random coins generator
134+
- `ring.Poly` is now a reslice of an 1D `[]uint64` backing array instead of
135+
a collection of independently allocated 1D arrays
136+
- Added `Point`, `Vector` and `Matrix` structs with many associated methods
137+
- Added the `Stats` method which returns log2(std) and mean of a Poly.
138+
139+
- `utils`:
140+
- Removed many slices utilities, which are now available through the native package `slice`
141+
- Removed `Min` and `Max` which now have native supported in Go as `min` and `max`
142+
143+
- `structs`:
144+
- Added `Copyer` interface and support (TODO review copy/clone)
145+
146+
- `sampling`:
147+
- Replaced the blake2b based XOF (`sampling.PRNG`) by the `math/rand/v2` ChaCha8-based CSPRNG (`sampling.Source`).
148+
- The `sampling.Source` struct is now used for all sampling the library
149+
150+
- `bignum`:
151+
- Refactored and fixed many bugs in the multi-interval Remez minimax polynomial approximation algorithm which now properly works when doing multi-interval approximations.
152+
- Added `Log2ErfC` which returns the base 2 logarithm of the complementary error function.
153+
- Added `Stats([]big.Int, prec)`, which returns the base 2 logarithm of the standard deviation and the mean
154+
- Added `ToComplexSlice` to cast a numerical slice to a `[]bignum.Complex`
155+
156+
- `concurrency`:
157+
- New package providing basic support for concurrency.
158+
159+
Others:
160+
- Improved issue template
161+
162+
## [0.0.0] - 12.06.2024
163+
164+
- Fork of Lattigo v5.0.2

.github/CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test

.github/ISSUE_TEMPLATE/bug-report.md

-28
This file was deleted.

.github/ISSUE_TEMPLATE/bug-report.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Bug Report
2+
description: File a bug report.
3+
title: "Bug [package]: "
4+
labels: ["bug"]
5+
assignees:
6+
- Pro7ech
7+
body:
8+
- type: input
9+
id: contact
10+
attributes:
11+
label: Contact Details
12+
description: How can we get in touch with you if we need more info?
13+
placeholder: ex. email@example.com
14+
validations:
15+
required: false
16+
- type: dropdown
17+
id: version
18+
attributes:
19+
label: Does this issue still happens with the latest release (@latest) ?
20+
options:
21+
- "Yes"
22+
- "No"
23+
default: 0
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: description
28+
attributes:
29+
label: Description
30+
description: Please describe what you were trying to do, what you where expecting to happen and what actually happened.
31+
value: "Describe what happened"
32+
validations:
33+
required: true
34+
- type: textarea
35+
id: logs
36+
attributes:
37+
label: Relevant Log Output
38+
description: Please copy and paste any relevant log output, they will be automatically formatted into code.
39+
render: shell
40+
- type: textarea
41+
id: reproducibility
42+
attributes:
43+
label: Reproducibility
44+
description: Please provide a short self-contained main.go that reproduces the issue, along with the go.mod and go.sum if necessary.
45+

.github/ISSUE_TEMPLATE/config.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
blank_issues_enabled: true
22
contact_links:
3-
- name: Feature Proposal/Request
4-
url: https://tuneinsight.com/lattigo/contact
5-
about: We do not use GitHub Issues for features proposals or requests. If you have a proposal or would like to make a request for a feature, please contact us directly.
6-
- name: General Question
7-
url: https://github.com/tuneinsight/lattigo/discussions
3+
- name: General Question
4+
url: https://github.com/Pro7ech/lattigo/discussions
85
about: Ask a question that is not necessarily related to the use or implementation of the library.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Feature-Request
3+
about: Propose or request a new feature
4+
title: 'Feature Request:'
5+
labels: new feature
6+
assignees: ''
7+
---

.github/ISSUE_TEMPLATE/question.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
name: Library Question
3-
about: Ask a question related to the use or implementation of the library.
3+
about: Ask a question related to the use, behavior or implementation of the library.
44
title: 'Question:'
55
labels: question
66
assignees: ''
77

88
---
99

1010
<!--
11-
Make sure that your question is directly related to the use or the implementation of the library before submitting it as we do not use GitHub Issues for general discussion. If your question is general (e.g. "How can I do <xxx> in FHE?"" or "Why don't I get the correct result?"), please use the dedicated https://github.com/tuneinsight/lattigo/discussions instead.
11+
Make sure that your question is directly related to the use, behavior or the implementation of the library before submitting it as we do not use GitHub Issues for general discussion. If your question is general (e.g. "How can I do <xxx> in FHE?"" or "Why don't I get the correct result?"), please use the dedicated https://github.com/Pro7ech/lattigo/discussions instead.
1212
13-
If you want to keep your question private, you can contact us directly using the following email: lattigo@tuneinsight.com.
13+
If you want to keep your question private, you can contact us directly using the following email: jeanphilippe.bossuat@gmail.com.
1414
-->

.github/ISSUE_TEMPLATE/suggestion.md

Whitespace-only changes.

SECURITY.md .github/SECURITY.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Report a Vulnerability
2-
To report a vulnerability please contact us directly using the following email: lattigo@tuneinsight.com.
3-
4-
# Code Review
5-
Lattigo 2.0.0 has been code-reviewed by ELCA in November 2020 and, within the allocated time for the code review, no critical or high-risk issues were found.
2+
To report a vulnerability please contact us directly using the following email: [jeanphilippe.bossuat@gmail.com](mailto:jeanphilippe.bossuat@gmail.com).
63

74
# Security of Approximate Homomorphic Encryption
85
Homomorphic encryption schemes are by definition malleable, and are therefore not secure against chosen ciphertext attacks (CCA security). They can be though secure against chosen plaintext attacks (CPA security).
@@ -12,7 +9,7 @@ Classified as an _approximate decryption_ scheme, the CKKS scheme is secure as l
129
This attack demonstrates that, when using an approximate homomorphic encryption scheme, the usual CPA security may not sufficient depending on the application setting. Many applications do not require to share the result with external parties and are not affected by this attack, but the ones that do must take the appropriate steps to ensure that no key-dependent information is leaked. A homomorphic encryption scheme that provides such functionality and that can be secure when releasing decrypted plaintext to external parties is defined to be CPA<sup>D</sup> secure. The corresponding indistinguishability notion (IND-CPA<sup>D</sup>) is defined as "indistinguishability under chosen plaintext attacks with decryption oracles."
1310

1411
# CPA<sup>D</sup> Security for Approximate Homomorphic Encryption
15-
Lattigo implements tools to mitigate _Li and Micciancio_'s attack. In particular, the decoding step of CKKS (and its real-number variant R-CKKS) allows the user to specify the desired fixed-point bit-precision.
12+
The library implements tools to mitigate _Li and Micciancio_'s attack. In particular, the decoding step of CKKS (and its real-number variant R-CKKS) allows the user to specify the desired fixed-point bit-precision.
1613

1714
Let $\epsilon$ be the scheme error after the decoding step. We compute the bit precision of the output as $\log_{2}(1/\epsilon)$.
1815

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Go
1313
uses: actions/setup-go@v4
1414
with:
15-
go-version: '1.21.1'
15+
go-version: '1.23.2'
1616

1717
- uses: actions/cache@v3
1818
with:
@@ -25,14 +25,14 @@ jobs:
2525
run: make get_tools
2626

2727
- name: Run Makefile checks
28-
run: make static_check
28+
run: make lint
2929

3030
tests:
3131
name: Run Go ${{ matrix.go }} tests
3232
runs-on: ubuntu-latest
3333
strategy:
3434
matrix:
35-
go: ['1.21.1', '1.20.8', '1.19.13', '1.18.10']
35+
go: ['1.23.2']
3636

3737
steps:
3838
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)