AdditiveShare API uses vector size instead of logslot

This commit is contained in:
Christian Mouchet
2023-07-17 14:24:58 +02:00
parent 2c38ec1447
commit 1ad7d9a6e3
2 changed files with 5 additions and 7 deletions

View File

@@ -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

View File

@@ -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)