Merge in latest updates from lattigo

This commit is contained in:
2025-08-06 20:09:12 -05:00
parent bd8c210383
commit 78026c60eb
183 changed files with 565 additions and 621 deletions
+1 -1
View File
@@ -4,5 +4,5 @@ contact_links:
url: https://lux.network/lattice/contact
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.
- name: General Question
url: https://github.com/luxdefi/lattice/discussions
url: https://github.com/luxfi/lattice/discussions
about: Ask a question that is not necessarily related to the use or implementation of the library.
+1 -1
View File
@@ -8,7 +8,7 @@ assignees: ''
---
<!--
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/luxdefi/lattice/discussions instead.
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/luxfi/lattice/discussions instead.
If you want to keep your question private, you can contact us directly using the following email: [email protected].
-->
+1 -1
View File
@@ -399,7 +399,7 @@ All notable changes to this library are documented in this file.
- CKKS: encoder is now about 3.5x faster (without taking the NTT into account).
## [3.0.0] - 2022-02-21
- ALL: renamed the module to `github.com/luxdefi/v3`.
- ALL: renamed the module to `github.com/luxfi/v3`.
- RING: renamed `FastBasisExtender` to `BasisExtender`.
- RING: `.PolyToBigint[...](*)` now take as input `gap` which defines the multiples of `X^{i*gap}` to reconstruct.
- RLWE: removed `FastEncryptor`. Encryption without rescaling by `P` is now automatically used by `Encryptor` if no `P` is specified in the parameters.
+1 -1
View File
@@ -4,7 +4,7 @@ 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](https://luxdefi.com).
by [Tune Insight SA](https://lux.network).
Active development of new features in Lattice is still carried out both at the
EPFL Laboratory for Data Security and at Tune Insight SA.
+9 -9
View File
@@ -2,7 +2,7 @@
## Lattice-based multiparty homomorphic encryption library in Go
![Go tests](https://github.com/luxdefi/lattice/actions/workflows/ci.yml/badge.svg)
![Go tests](https://github.com/luxfi/lattice/actions/workflows/ci.yml/badge.svg)
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:
@@ -111,15 +111,15 @@ The Lattice library was originally exclusively developed by the EPFL Laboratory
until its version 2.4.0.
Starting with the release of version 3.0.0, Lattice is maintained and supported by [Tune Insight
SA](https://luxdefi.com).
SA](https://lux.network).
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
`github.com/luxfi/lattice/v[X]`, and the official repository has been moved to
https://github.com/luxfi/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
- To upgrade to a version X.y.z >= 3.0.0, depending modules must require `github.com/luxfi/lattice/v[X]/`,
for example by changing the imports to `github.com/luxfi/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,
@@ -145,13 +145,13 @@ External pull requests only proposing small or trivial changes will be converted
## License
Lattice is licensed under the Apache 2.0 License. See [LICENSE](https://github.com/luxdefi/lattice/blob/master/LICENSE).
Lattice is licensed under the Apache 2.0 License. See [LICENSE](https://github.com/luxfi/lattice/blob/master/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](mailto:[email protected]).
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@lux.network](mailto:[email protected]).
## Citing
@@ -159,7 +159,7 @@ Please use the following BibTex entry for citing Lattice:
@misc{lattice,
title = {Lattice v5},
howpublished = {Online: \url{https://github.com/luxdefi/lattice}},
howpublished = {Online: \url{https://github.com/luxfi/lattice}},
month = Nov,
year = 2023,
note = {EPFL-LDS, Tune Insight SA}
+1 -1
View File
@@ -1,5 +1,5 @@
# Report a Vulnerability
To report a vulnerability please contact us directly using the following email: lattice@luxdefi.com.
To report a vulnerability please contact us directly using the following email: lattice@lux.network.
# Code Review
Lattice 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.
+5 -5
View File
@@ -2,11 +2,11 @@
package lintrans
import (
"github.com/tuneinsight/lattigo/v6/circuits/common/lintrans"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/schemes"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/luxfi/lattice/v6/circuits/common/lintrans"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/schemes"
"github.com/luxfi/lattice/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/utils"
)
// Diagonals is a wrapper of [lintrans.Diagonals].
+3 -3
View File
@@ -9,9 +9,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/tuneinsight/lattigo/v6/utils/sampling"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/utils/sampling"
)
var flagParamString = flag.String("params", "", "specify the test cryptographic parameters as a JSON string. Overrides -short.")
+3 -3
View File
@@ -2,9 +2,9 @@
package polynomial
import (
"github.com/tuneinsight/lattigo/v6/circuits/common/polynomial"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/circuits/common/polynomial"
"github.com/luxfi/lattice/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/utils/bignum"
)
// Polynomial is a type wrapping the type [polynomial.Polynomial].
@@ -3,9 +3,9 @@ package polynomial
import (
"fmt"
"github.com/tuneinsight/lattigo/v6/circuits/common/polynomial"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/circuits/common/polynomial"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/schemes/bgv"
)
type Evaluator struct {
@@ -4,10 +4,10 @@ import (
"math/big"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/schemes/bgv"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/schemes/bgv"
"github.com/luxfi/lattice/v5/utils"
)
// simEvaluator is a struct used to pre-computed the scaling
@@ -8,9 +8,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/utils/bignum"
)
var flagParamString = flag.String("params", "", "specify the test cryptographic parameters as a JSON string. Overrides -short.")
+1 -1
View File
@@ -2,7 +2,7 @@
// approximate homomorphic encryption over the complex/real numbers (CKKS scheme).
package bootstrapping
import "github.com/tuneinsight/lattigo/v6/core/rlwe"
import "github.com/luxfi/lattice/v6/core/rlwe"
type Bootstrapper interface {
@@ -6,11 +6,11 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/sampling"
)
var flagLongTest = flag.Bool("long", false, "run the long test suite (all parameters + secure bootstrapping). Overrides -short and requires -timeout=0.")
@@ -1,9 +1,9 @@
package bootstrapping
import (
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
type defaultParametersLiteral struct {
+8 -8
View File
@@ -6,14 +6,14 @@ import (
"math/big"
"math/bits"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/dft"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/mod1"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/polynomial"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/circuits/ckks/dft"
"github.com/luxfi/lattice/v6/circuits/ckks/mod1"
"github.com/luxfi/lattice/v6/circuits/ckks/polynomial"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils"
"github.com/luxfi/lattice/v6/utils/bignum"
)
// Evaluator is a struct to store a memory buffer with the plaintext matrices,
@@ -5,8 +5,8 @@ import (
"time"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
)
func BenchmarkBootstrap(b *testing.B) {
@@ -7,10 +7,10 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/sampling"
)
var minPrec float64 = 12.0
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"fmt"
"io"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/utils/buffer"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/utils/buffer"
)
// EvaluationKeys is a struct storing the different
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/schemes/ckks"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/schemes/ckks"
"github.com/luxfi/lattice/v5/utils"
)
// Parameters is a struct storing the parameters
@@ -6,10 +6,10 @@ import (
"math"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
// ParametersLiteral is a struct to parameterize the bootstrapping parameters.
@@ -1,9 +1,9 @@
package bootstrapping
import (
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// SecretKeyBootstrapper is an implementation of the rlwe.Bootstrapping interface that
+4 -4
View File
@@ -3,10 +3,10 @@ package hefloat
import (
"math/big"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// ComparisonEvaluator is an evaluator providing an API for homomorphic comparisons.
+5 -5
View File
@@ -9,11 +9,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/bootstrapping"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/minimax"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/circuits/ckks/bootstrapping"
"github.com/luxfi/lattice/v6/circuits/ckks/minimax"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/ckks"
)
var printPrecisionStats = flag.Bool("print-precision", false, "print precision stats")
+6 -6
View File
@@ -6,12 +6,12 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/schemes/ckks"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/schemes/ckks"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// EvaluatorForDFT is an interface defining the set of methods required to instantiate a DFTEvaluator.
+6 -6
View File
@@ -7,12 +7,12 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/sampling"
)
func TestHomomorphicDFT(t *testing.T) {
+3 -3
View File
@@ -4,9 +4,9 @@ import (
"fmt"
"math"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/utils"
)
// EvaluatorForInverse defines a set of common and scheme agnostic
+7 -7
View File
@@ -9,13 +9,13 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/bootstrapping"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/comparison"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/minimax"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/circuits/ckks/bootstrapping"
"github.com/luxfi/lattice/v6/circuits/ckks/comparison"
"github.com/luxfi/lattice/v6/circuits/ckks/minimax"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils/bignum"
)
var printPrecisionStats = flag.Bool("print-precision", false, "print precision stats")
+5 -5
View File
@@ -2,11 +2,11 @@
package lintrans
import (
"github.com/tuneinsight/lattigo/v6/circuits/common/lintrans"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/schemes"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/luxfi/lattice/v6/circuits/common/lintrans"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/schemes"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils"
)
// Diagonals is a wrapper of [lintrans.Diagonals].
+6 -6
View File
@@ -12,12 +12,12 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/tuneinsight/lattigo/v6/utils/sampling"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils"
"github.com/luxfi/lattice/v6/utils/bignum"
"github.com/luxfi/lattice/v6/utils/sampling"
)
var flagParamString = flag.String("params", "", "specify the test cryptographic parameters as a JSON string. Overrides -short.")
@@ -5,8 +5,8 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// MinimaxCompositePolynomial is a struct storing P(x) = pk(x) o pk-1(x) o ... o p1(x) o p0(x).
@@ -3,9 +3,9 @@ package hefloat
import (
"fmt"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/ring"
)
// EvaluatorForMinimaxCompositePolynomial defines a set of common and scheme agnostic method that are necessary to instantiate a MinimaxCompositePolynomialEvaluator.
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"math/big"
"math/cmplx"
"github.com/tuneinsight/lattigo/v6/circuits/ckks/polynomial"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/circuits/ckks/polynomial"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils/bignum"
)
// Evaluator is an evaluator providing an API for homomorphic evaluations of scaled x mod 1.
+4 -4
View File
@@ -7,10 +7,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/sampling"
)
func TestMod1(t *testing.T) {
+4 -4
View File
@@ -7,10 +7,10 @@ import (
"math/big"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat/cosine"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat/cosine"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// Mod1Type is the type of function/approximation used to evaluate x mod 1.
+2 -2
View File
@@ -3,8 +3,8 @@ package hefloat
import (
"math/big"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// Polynomial is a type wrapping the type he.Polynomial.
@@ -3,10 +3,10 @@ package polynomial
import (
"fmt"
"github.com/tuneinsight/lattigo/v6/circuits/common/polynomial"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/circuits/common/polynomial"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils/bignum"
)
// Evaluator is a wrapper of the [polynomial.Evaluator].
@@ -4,10 +4,10 @@ import (
"math/big"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// simEvaluator is a struct used to pre-computed the scaling
@@ -11,9 +11,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/ckks"
"github.com/tuneinsight/lattigo/v6/utils/bignum"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/ckks"
"github.com/luxfi/lattice/v6/utils/bignum"
)
var flagParamString = flag.String("params", "", "specify the test cryptographic parameters as a JSON string. Overrides -short.")
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"fmt"
"sort"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// LinearTransformationParameters is a struct storing the parameterization of a
@@ -3,10 +3,10 @@ package he
import (
"fmt"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// EvaluatorForLinearTransformation defines a set of common and scheme agnostic method necessary to instantiate an LinearTransformationEvaluator.
+3 -3
View File
@@ -4,9 +4,9 @@ import (
"fmt"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// Polynomial is a struct for representing plaintext polynomials
@@ -4,9 +4,9 @@ import (
"fmt"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// EvaluatorForPolynomial defines a set of common and scheme agnostic method that are necessary to instantiate a PolynomialVectorEvaluator.
@@ -1,7 +1,7 @@
package he
import (
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/core/rlwe"
)
// SimOperand is a dummy operand that
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"io"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxdefi/lattice/v5/utils/structs"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/utils/structs"
)
// PowerBasis is a struct storing powers of a ciphertext.
@@ -3,10 +3,10 @@ package he
import (
"testing"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/utils/sampling"
)
func TestPowerBasis(t *testing.T) {
-56
View File
@@ -1,56 +0,0 @@
func (n *Network) validateBlock(block *bfv.Ciphertext, sampleSize int) bool {
// 1. Sample a subset of nodes
sampleNodes := n.sampleNodes(sampleSize)
// 2. Ask each node in the sample to vote on the block
encryptedVotes := make(map[*Node]*bfv.Ciphertext)
for _, node := range sampleNodes {
encryptedVotes[node] = node.voteOnBlock(block)
}
// 3. Aggregate the encrypted votes
aggregatedVote := n.aggregateVotes(encryptedVotes)
// 4. Check if the aggregated vote exceeds the threshold
isValid := n.checkThreshold(aggregatedVote)
// 5. Return the decision
return isValid
}
func (n *Network) sampleNodes(sampleSize int) []*Node {
// Randomly select a subset of nodes from the network.
return n.randomNodes(sampleSize)
}
func (n *Network) aggregateVotes(encryptedVotes map[*Node]*bfv.Ciphertext) *bfv.Ciphertext {
// Use the homomorphic properties of BFV to aggregate the votes.
aggregatedVote := new(bfv.Ciphertext)
for _, vote := range encryptedVotes {
aggregatedVote.Add(aggregatedVote, vote)
}
return aggregatedVote
}
func (n *Network) checkThreshold(aggregatedVote *bfv.Ciphertext) bool {
// Use the homomorphic properties of BFV to check if the aggregated vote exceeds the threshold.
// Compare the encrypted aggregated vote to an encrypted representation of the threshold.
return n.isAboveThreshold(aggregatedVote)
}
func main() {
// Initialize network
// ...
// For each block:
for _, block := range blocks {
// Validate block using Avalanche consensus protocol
if network.validateBlock(block, sampleSize) {
// If the block is valid, add it to the blockchain
network.addBlock(block)
}
}
}
I have removed the block.hash%2==0 condition and replaced it with a random vote. I have also removed the mention of CKKS.
+2 -2
View File
@@ -2,8 +2,8 @@
package hebin
import (
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
)
// InitTestPolynomial takes a function g, and creates a test polynomial polynomial for the function in the interval [a, b].
@@ -3,9 +3,9 @@ package hebin
import (
"testing"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/sampling"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
func testString(params rlwe.Parameters, opname string) string {
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"fmt"
"math/big"
"github.com/luxdefi/lattice/v5/core/rgsw"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/core/rgsw"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// Evaluator is a struct that stores the necessary
+4 -4
View File
@@ -3,10 +3,10 @@ package hebin
import (
"math/big"
"github.com/luxdefi/lattice/v5/core/rgsw"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rgsw"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
const (
+2 -2
View File
@@ -3,8 +3,8 @@ package hebin
import (
"math/big"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// MulBySmallMonomialMod2N multiplies pol by x^n, with 0 <= n < N
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"bufio"
"io"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils/buffer"
)
// Ciphertext is a generic type for RGSW ciphertext.
+2 -2
View File
@@ -1,8 +1,8 @@
package rgsw
import (
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring/ringqp"
)
// Encryptor is a type for encrypting RGSW ciphertexts. It implements the rlwe.Encryptor
+3 -3
View File
@@ -1,9 +1,9 @@
package rgsw
import (
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
)
// Evaluator is a type for evaluating homomorphic operations involving RGSW ciphertexts.
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"math/big"
"testing"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/stretchr/testify/require"
)
+2 -2
View File
@@ -1,8 +1,8 @@
package rgsw
import (
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/ring"
)
// NoiseRGSWCiphertext returns the log2 of the standard deviation of the noise of each component of the RGSW ciphertext.
+2 -2
View File
@@ -3,8 +3,8 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/sampling"
)
// Ciphertext is a generic type for RLWE ciphertexts.
+2 -2
View File
@@ -3,8 +3,8 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
// Decryptor is a structure used to decrypt Ciphertext. It stores the secret-key.
+1 -1
View File
@@ -3,7 +3,7 @@ package rlwe
import (
"math"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring"
)
type Distribution struct {
+5 -5
View File
@@ -6,11 +6,11 @@ import (
"io"
"github.com/google/go-cmp/cmp"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxdefi/lattice/v5/utils/structs"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/utils/structs"
)
// ElementInterface is a common interface for Ciphertext and Plaintext types.
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"fmt"
"reflect"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/sampling"
)
// EncryptionKey is an interface for encryption keys. Valid encryption
+3 -3
View File
@@ -3,9 +3,9 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// Evaluator is a struct that holds the necessary elements to execute general homomorphic
+3 -3
View File
@@ -3,9 +3,9 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// Automorphism computes phi(ct), where phi is the map X -> X^galEl. The method requires
+2 -2
View File
@@ -3,8 +3,8 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
// ApplyEvaluationKey is a generic method to apply an EvaluationKey on a ciphertext.
+3 -3
View File
@@ -3,9 +3,9 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// GadgetProduct evaluates poly x Gadget -> RLWE where
+5 -5
View File
@@ -6,11 +6,11 @@ import (
"io"
"github.com/google/go-cmp/cmp"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxdefi/lattice/v5/utils/structs"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/utils/structs"
)
// GadgetCiphertext is a struct for storing an encrypted
+3 -3
View File
@@ -1,9 +1,9 @@
package rlwe
import (
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// InnerSum applies an optimized inner sum on the Ciphertext (log2(n) + HW(n) rotations with double hoisting).
+3 -3
View File
@@ -3,9 +3,9 @@ package rlwe
import (
"fmt"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// KeyGenerator is a structure that stores the elements required to create new keys,
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"io"
"github.com/google/go-cmp/cmp"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxdefi/lattice/v5/utils/structs"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/utils/structs"
)
// SecretKey is a type for generic RLWE secret keys.
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"math/big"
"github.com/google/go-cmp/cmp"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
)
// MetaData is a struct storing metadata.
+3 -3
View File
@@ -8,9 +8,9 @@ import (
"math/bits"
"github.com/google/go-cmp/cmp"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
)
// MaxLogN is the log2 of the largest supported polynomial modulus degree.
+2 -2
View File
@@ -3,8 +3,8 @@ package rlwe
import (
"io"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/sampling"
)
// Plaintext is a common base type for RLWE plaintexts.
+3 -3
View File
@@ -3,9 +3,9 @@ package rlwe
import (
"fmt"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/ring/ringqp"
"github.com/tuneinsight/lattigo/v6/utils/structs"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/ring/ringqp"
"github.com/luxfi/lattice/v6/utils/structs"
)
// BufferPool represents a pool of different objects (plaintexts, ciphertexts, polys) that can be used to instantiate temporary buffers.
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"fmt"
"math/big"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/utils"
)
// RingPackingEvaluator is an evaluator for Ring-LWE packing operations.
+2 -2
View File
@@ -3,8 +3,8 @@ package rlwe
import (
"fmt"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/utils"
)
// RingPackingEvaluationKey is a struct storing the
+2 -2
View File
@@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/utils"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/utils"
)
const (
+2 -2
View File
@@ -3,8 +3,8 @@
package rlwe
import (
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/ring/ringqp"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/ring/ringqp"
)
type EvaluatorProvider interface {
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils"
)
func BenchmarkRLWE(b *testing.B) {
+6 -6
View File
@@ -10,12 +10,12 @@ import (
"github.com/stretchr/testify/require"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/ring/ringqp"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/buffer"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxdefi/lattice/v5/utils/structs"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/ring/ringqp"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/buffer"
"github.com/luxfi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/utils/structs"
)
var flagParamString = flag.String("params", "", "specify the test cryptographic parameters as a JSON string. Overrides -short and -long.")
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/bignum"
)
const (
+1 -1
View File
@@ -1,6 +1,6 @@
package rlwe
import "github.com/luxdefi/lattice/v5/ring"
import "github.com/luxfi/lattice/v5/ring"
const (
// XsUniformTernary is the standard deviation of a ternary key with uniform distribution
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
// NoisePublicKey returns the log2 of the standard deviation of the input public-key with respect to the given secret-key and parameters.
+2 -2
View File
@@ -3,8 +3,8 @@ package examples
import (
"testing"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/he/heint"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/he/heint"
)
func TestExampleParams(t *testing.T) {
+5 -5
View File
@@ -41,11 +41,11 @@ import (
"sync"
"time"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/multiparty"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/tuneinsight/lattigo/v6/utils/sampling"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/multiparty"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/utils/sampling"
)
// party is a type for the parties' state in the protocol, to be kept accross the different phases.
+5 -5
View File
@@ -29,11 +29,11 @@ import (
"sync"
"time"
"github.com/tuneinsight/lattigo/v6/core/rlwe"
"github.com/tuneinsight/lattigo/v6/multiparty"
"github.com/tuneinsight/lattigo/v6/ring"
"github.com/tuneinsight/lattigo/v6/schemes/bgv"
"github.com/tuneinsight/lattigo/v6/utils/sampling"
"github.com/luxfi/lattice/v6/core/rlwe"
"github.com/luxfi/lattice/v6/multiparty"
"github.com/luxfi/lattice/v6/ring"
"github.com/luxfi/lattice/v6/schemes/bgv"
"github.com/luxfi/lattice/v6/utils/sampling"
)
// party is a type for the parties' state in the protocol, to be kept accross the different phases.
@@ -8,9 +8,9 @@ import (
"sync"
"time"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/mhe"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/mhe"
"github.com/luxfi/lattice/v5/utils/sampling"
)
// This example showcases the use of the mhe package to generate an evaluation key in a multiparty setting.
+3 -3
View File
@@ -1,9 +1,9 @@
package examples
import (
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/he/heint"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/he/heint"
"github.com/luxfi/lattice/v5/ring"
)
var (
@@ -6,11 +6,11 @@ import (
"math"
"math/bits"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/utils/sampling"
"github.com/luxdefi/lattice/v5/he/heint"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/he/heint"
"github.com/luxfi/lattice/v5/ring"
)
var flagShort = flag.Bool("short", false, "run the example with a smaller and insecure ring degree.")
@@ -6,9 +6,9 @@ import (
"math/big"
"time"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/sampling"
)
// Vectorized oblivious evaluation is a two-party protocol for the function f(x) = ax + b where a sender
@@ -10,12 +10,12 @@ import (
"fmt"
"math"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/he/hefloat/bootstrapping"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/he/hefloat/bootstrapping"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/sampling"
)
var flagShort = flag.Bool("short", false, "run the example with a smaller and insecure ring degree.")
@@ -24,13 +24,13 @@ import (
"fmt"
"math"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/he/hefloat/bootstrapping"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/he/hefloat/bootstrapping"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/sampling"
)
var flagShort = flag.Bool("short", false, "run the example with a smaller and insecure ring degree.")
@@ -38,12 +38,12 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/he/hefloat/bootstrapping"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/he/hefloat/bootstrapping"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/utils/sampling"
)
var flagShort = flag.Bool("short", false, "run the example with a smaller and insecure ring degree.")
@@ -13,11 +13,11 @@ import (
"math/big"
"time"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hebin"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hebin"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
// ========================================
@@ -6,11 +6,11 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/sampling"
)
func main() {
@@ -6,11 +6,11 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/sampling"
)
func main() {
@@ -6,11 +6,11 @@ import (
"math"
"math/big"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hefloat"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils/bignum"
"github.com/luxdefi/lattice/v5/utils/sampling"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hefloat"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils/bignum"
"github.com/luxfi/lattice/v5/utils/sampling"
)
func main() {
@@ -6,10 +6,10 @@ import (
"fmt"
"time"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/hebin"
"github.com/luxdefi/lattice/v5/ring"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/hebin"
"github.com/luxfi/lattice/v5/ring"
"github.com/luxfi/lattice/v5/utils"
)
// Function to evaluate
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"fmt"
"math/rand"
"github.com/luxdefi/lattice/v5/core/rlwe"
"github.com/luxdefi/lattice/v5/he/heint"
"github.com/luxdefi/lattice/v5/utils"
"github.com/luxfi/lattice/v5/core/rlwe"
"github.com/luxfi/lattice/v5/he/heint"
"github.com/luxfi/lattice/v5/utils"
)
func main() {

Some files were not shown because too many files have changed in this diff Show More