diff --git a/dckks/sharing.go b/dckks/sharing.go index c9c5b2b2..610726cc 100644 --- a/dckks/sharing.go +++ b/dckks/sharing.go @@ -28,11 +28,12 @@ type EncToShareProtocol struct { func NewAdditiveShare(params ckks.Parameters, logSlots int) drlwe.AdditiveShareBigint { + nValues := 1 << logSlots if params.RingType() == ring.Standard { - logSlots++ + nValues <<= 1 } - return drlwe.NewAdditiveShareBigint(logSlots) + return drlwe.NewAdditiveShareBigint(nValues) } // ShallowCopy creates a shallow copy of EncToShareProtocol in which all the read-only data-structures are diff --git a/drlwe/additive_shares.go b/drlwe/additive_shares.go index 0651bb33..3f4899a4 100644 --- a/drlwe/additive_shares.go +++ b/drlwe/additive_shares.go @@ -23,11 +23,8 @@ func NewAdditiveShare(r *ring.Ring) AdditiveShare { return AdditiveShare{Value: r.NewPoly()} } -// NewAdditiveShareBigint instantiates a new additive share struct composed of "2^logslots" big.Int elements. -func NewAdditiveShareBigint(logSlots int) AdditiveShareBigint { - - n := 1 << logSlots - +// NewAdditiveShareBigint instantiates a new additive share struct composed of n big.Int elements. +func NewAdditiveShareBigint(n int) AdditiveShareBigint { v := make([]*big.Int, n) for i := range v { v[i] = new(big.Int)