mirror of
https://github.com/tuneinsight/lattigo.git
synced 2025-09-13 03:27:14 +00:00
style: clean up
This commit is contained in:
@@ -62,7 +62,10 @@ func (enc Encryptor) GetRLWEParameters() *Parameters {
|
||||
|
||||
func newEncryptor(params Parameters) *Encryptor {
|
||||
|
||||
prng := &sampling.ThreadSafePRNG{}
|
||||
prng, err := sampling.NewPRNG()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("newEncryptor: %w", err))
|
||||
}
|
||||
|
||||
var bc *ring.BasisExtender
|
||||
if params.PCount() != 0 {
|
||||
@@ -84,11 +87,10 @@ func newEncryptor(params Parameters) *Encryptor {
|
||||
}
|
||||
|
||||
return &Encryptor{
|
||||
params: params,
|
||||
prng: prng,
|
||||
xeSampler: xeSampler,
|
||||
xsSampler: xsSampler,
|
||||
// encryptorBuffers: newEncryptorBuffers(params),
|
||||
params: params,
|
||||
prng: prng,
|
||||
xeSampler: xeSampler,
|
||||
xsSampler: xsSampler,
|
||||
uniformSampler: ringqp.NewUniformSampler(prng, *params.RingQP()),
|
||||
basisextender: bc,
|
||||
}
|
||||
@@ -118,20 +120,6 @@ func newTestEncryptorWithKeyedPRNG(params ParameterProvider, key EncryptionKey,
|
||||
return enc
|
||||
}
|
||||
|
||||
// type encryptorBuffers struct {
|
||||
// buffQP [3]ringqp.Poly
|
||||
// }
|
||||
|
||||
// func newEncryptorBuffers(params Parameters) *encryptorBuffers {
|
||||
// return &encryptorBuffers{
|
||||
// buffQP: [3]ringqp.Poly{
|
||||
// params.RingQP().NewPoly(),
|
||||
// params.RingQP().NewPoly(),
|
||||
// params.RingQP().NewPoly(),
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
// Encrypt encrypts the input plaintext using the stored encryption key and writes the result on ct.
|
||||
// The method currently accepts only *[Ciphertext] as ct.
|
||||
// If a [Plaintext] is given, then the output [Ciphertext] [MetaData] will match the [Plaintext] [MetaData].
|
||||
|
||||
@@ -39,10 +39,9 @@ func testString(params Parameters, levelQ, levelP, bpw2 int, opname string) stri
|
||||
// If such a modification is intended, this test must be updated and users notified s.t.
|
||||
// old serialized objects can be converted to the new format.
|
||||
func TestRLWEConstSerialization(t *testing.T) {
|
||||
t.Skip()
|
||||
// Note: changing nbIteration will change the expected value
|
||||
const nbIteration = 10
|
||||
const expected = "/mTt2kB+03NdOMoI1msW+glCZmrF1sxEGQkFsC6P1SA="
|
||||
const expected = "rlzKK0ti5MY4b2nJ9iPKFGHVoZI2w9Hr9doLdIreahM="
|
||||
var err error
|
||||
defaultParamsLiteral := testInsecure
|
||||
seedKeyGen := []byte{'l', 'a', 't'}
|
||||
|
||||
@@ -72,7 +72,7 @@ func (g *GaussianSampler) read(pol Poly, f func(a, b, c uint64) uint64) {
|
||||
|
||||
r := g.baseRing
|
||||
|
||||
randomBufferN := make([]byte, 4*r.N())
|
||||
randomBufferN := make([]byte, 1024)
|
||||
var ptr int
|
||||
|
||||
level := r.level
|
||||
|
||||
@@ -22,6 +22,7 @@ type TernarySampler struct {
|
||||
|
||||
// NewTernarySampler creates a new instance of TernarySampler from a PRNG, the ring definition and the distribution
|
||||
// parameters (see type Ternary). If "montgomery" is set to true, polynomials read from this sampler are in Montgomery form.
|
||||
// WARNING: If the PRNG is deterministic/keyed (of type [sampling.KeyedPRNG]), *concurrent* calls to the sampler will not necessarily result in a deterministic output.
|
||||
func NewTernarySampler(prng sampling.PRNG, baseRing *Ring, X Ternary, montgomery bool) (ts *TernarySampler, err error) {
|
||||
ts = new(TernarySampler)
|
||||
ts.baseSampler = &baseSampler{}
|
||||
|
||||
Reference in New Issue
Block a user