Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCKKSParameters = []ckks.ParametersLiteral{ { LogN: 16, LogSlots: 15, DefaultScale: 1 << 40, Sigma: rlwe.DefaultSigma, Q: []uint64{ 0x10000000006e0001, 0x10000140001, 0xffffe80001, 0xffffc40001, 0x100003e0001, 0xffffb20001, 0x10000500001, 0xffff940001, 0xffff8a0001, 0xffff820001, 0x7fffe60001, 0x7fffe40001, 0x7fffe00001, 0xfffffffff840001, 0x1000000000860001, 0xfffffffff6a0001, 0x1000000000980001, 0xfffffffff5a0001, 0x1000000000b00001, 0x1000000000ce0001, 0xfffffffff2a0001, 0x100000000060001, 0xfffffffff00001, 0xffffffffd80001, 0x1000000002a0001, }, P: []uint64{ 0x1fffffffffe00001, 0x1fffffffffc80001, 0x1fffffffffb40001, 0x1fffffffff500001, 0x1fffffffff420001, }, }, { LogN: 16, LogSlots: 15, DefaultScale: 1 << 45, Sigma: rlwe.DefaultSigma, Q: []uint64{ 0x10000000006e0001, 0x2000000a0001, 0x2000000e0001, 0x1fffffc20001, 0x200000440001, 0x200000500001, 0x3ffffe80001, 0x3ffffd20001, 0x3ffffca0001, 0xffffffffffc0001, 0xfffffffff240001, 0x1000000000f00001, 0xfffffffff840001, 0x1000000000860001, 0xfffffffff6a0001, 0x1000000000980001, 0xfffffffff5a0001, 0x1000000000b00001, 0x1000000000ce0001, 0xfffffffff2a0001, 0x400000000360001, 0x3ffffffffbe0001, 0x400000000660001, 0x4000000008a0001, }, P: []uint64{ 0x1fffffffffe00001, 0x1fffffffffc80001, 0x1fffffffffb40001, 0x1fffffffff500001, }, }, { LogN: 16, LogSlots: 15, DefaultScale: 1 << 30, Sigma: rlwe.DefaultSigma, Q: []uint64{ 0x80000000080001, 0xffffffffffc0001, 0x10000000006e0001, 0xfffffffff840001, 0x1000000000860001, 0xfffffffff6a0001, 0x1000000000980001, 0xfffffffff5a0001, 0x1000000000b00001, 0x1000000000ce0001, 0x80000000440001, 0x7fffffffba0001, 0x80000000500001, 0x7fffffffaa0001, 0x800000005e0001, 0x7fffffff7e0001, 0x7fffffff380001, 0x80000000ca0001, 0x200000000e0001, 0x20000000140001, 0x20000000280001, 0x1fffffffd80001, }, P: []uint64{ 0x1fffffffffe00001, 0x1fffffffffc80001, 0x1fffffffffb40001, 0x1fffffffff500001, 0x1fffffffff420001, }, }, { LogN: 16, LogSlots: 15, DefaultScale: 1 << 40, Sigma: rlwe.DefaultSigma, Q: []uint64{ 0x4000000120001, 0x10000140001, 0xffffe80001, 0xffffc40001, 0x100003e0001, 0xffffb20001, 0x10000500001, 0xffff940001, 0xffff8a0001, 0xffff820001, 0x100000000060001, 0xffa0001, 0xffffffffffc0001, 0x10000000006e0001, 0xfffffffff840001, 0x1000000000860001, 0xfffffffff6a0001, 0x1000000000980001, 0xfffffffff5a0001, 0x1000000000b00001, 0x1000000000ce0001, 0xfffffffff2a0001, 0xfffffffff240001, 0x1000000000f00001, 0x200000000e0001, 0x20000000140001, 0x20000000280001, 0x1fffffffd80001, }, P: []uint64{ 0x1fffffffffe00001, 0x1fffffffffc80001, 0x1fffffffffb40001, 0x1fffffffff500001, 0x1fffffffff420001, 0x1fffffffff380001, }, }, { LogN: 15, LogSlots: 14, DefaultScale: 1 << 25, Sigma: rlwe.DefaultSigma, Q: []uint64{ 0x1fff90001, 0x4000000420001, 0x1fc0001, 0xffffffffffc0001, 0x4000000120001, 0x40000001b0001, 0x3ffffffdf0001, 0x4000000270001, 0x3ffffffd20001, 0x3ffffffcd0001, 0x4000000350001, 0x3ffffffc70001, 0x1fffffff50001, 0x1ffffffea0001, }, P: []uint64{ 0x7fffffffe0001, 0x8000000110001, }, }, }
DefaultCKKSParameters are default parameters for the bootstrapping. To be used in conjonction with DefaultParameters.
var DefaultParameters = []Parameters{ { H: 192, SlotsToCoeffsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.SlotsToCoeffs, LevelStart: 12, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x7fffe60001}, {0x7fffe40001}, {0x7fffe00001}, }, }, EvalModParameters: advanced.EvalModLiteral{ Q: 0x10000000006e0001, LevelStart: 20, SineType: advanced.Cos1, MessageRatio: 256.0, K: 25, SineDeg: 63, DoubleAngle: 2, ArcSineDeg: 0, ScalingFactor: 1 << 60, }, CoeffsToSlotsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.CoeffsToSlots, LevelStart: 24, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x100000000060001}, {0xfffffffff00001}, {0xffffffffd80001}, {0x1000000002a0001}, }, }, }, { H: 192, SlotsToCoeffsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.SlotsToCoeffs, LevelStart: 8, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x3ffffe80001}, {0x3ffffd20001}, {0x3ffffca0001}, }, }, EvalModParameters: advanced.EvalModLiteral{ Q: 0x10000000006e0001, LevelStart: 19, SineType: advanced.Cos1, MessageRatio: 4.0, K: 25, SineDeg: 63, DoubleAngle: 2, ArcSineDeg: 7, ScalingFactor: 1 << 60, }, CoeffsToSlotsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.CoeffsToSlots, LevelStart: 23, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x400000000360001}, {0x3ffffffffbe0001}, {0x400000000660001}, {0x4000000008a0001}, }, }, }, { H: 192, SlotsToCoeffsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.SlotsToCoeffs, LevelStart: 9, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {1073741824.0}, {1073741824.0062866, 1073741824.0062866}, }, }, EvalModParameters: advanced.EvalModLiteral{ Q: 0x80000000080001, LevelStart: 17, SineType: advanced.Cos1, MessageRatio: 256.0, K: 25, SineDeg: 63, DoubleAngle: 2, ArcSineDeg: 0, ScalingFactor: 1 << 55, }, CoeffsToSlotsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.CoeffsToSlots, LevelStart: 21, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x200000000e0001}, {0x20000000140001}, {0x20000000280001}, {0x1fffffffd80001}, }, }, }, { H: 32768, SlotsToCoeffsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.SlotsToCoeffs, LevelStart: 11, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {268435456.0007324, 268435456.0007324}, {0xffa0001}, }, }, EvalModParameters: advanced.EvalModLiteral{ Q: 0x4000000120001, LevelStart: 23, SineType: advanced.Cos2, MessageRatio: 256.0, K: 325, SineDeg: 255, DoubleAngle: 4, ArcSineDeg: 0, ScalingFactor: 1 << 60, }, CoeffsToSlotsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.CoeffsToSlots, LevelStart: 27, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x200000000e0001}, {0x20000000140001}, {0x20000000280001}, {0x1fffffffd80001}, }, }, }, { H: 192, SlotsToCoeffsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.SlotsToCoeffs, LevelStart: 3, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {1073741823.9998779, 1073741823.9998779}, }, }, EvalModParameters: advanced.EvalModLiteral{ Q: 0x1fff90001, LevelStart: 11, SineType: advanced.Cos1, MessageRatio: 256.0, K: 25, SineDeg: 63, DoubleAngle: 2, ArcSineDeg: 0, ScalingFactor: 1 << 50, }, CoeffsToSlotsParameters: advanced.EncodingMatrixLiteral{ LinearTransformType: advanced.CoeffsToSlots, LevelStart: 13, BSGSRatio: 2.0, BitReversed: false, ScalingFactor: [][]float64{ {0x1fffffff50001}, {0x1ffffffea0001}, }, }, }, }
DefaultParameters are default bootstrapping params for the bootstrapping.
Functions ¶
This section is empty.
Types ¶
type Bootstrapper ¶
Bootstrapper is a struct to stores a memory pool the plaintext matrices the polynomial approximation and the keys for the bootstrapping.
func NewBootstrapper ¶
func NewBootstrapper(params ckks.Parameters, btpParams Parameters, btpKey rlwe.EvaluationKey) (btp *Bootstrapper, err error)
NewBootstrapper creates a new Bootstrapper.
func (*Bootstrapper) Bootstrapp ¶
func (btp *Bootstrapper) Bootstrapp(ctIn *ckks.Ciphertext) (ctOut *ckks.Ciphertext)
Bootstrapp re-encrypt a ciphertext at lvl Q0 to a ciphertext at MaxLevel-k where k is the depth of the bootstrapping circuit. If the input ciphertext level is zero, the input scale must be an exact power of two smaller or equal to round(Q0/2^{10}). If the input ciphertext is at level one or more, the input scale does not need to be an exact power of two as one level can be used to do a scale matching.
func (Bootstrapper) CheckKeys ¶
func (bb Bootstrapper) CheckKeys(btpKey rlwe.EvaluationKey) (err error)
CheckKeys checks if all the necessary keys are present in the instantiated Bootstrapper
func (*Bootstrapper) ShallowCopy ¶
func (btp *Bootstrapper) ShallowCopy() *Bootstrapper
ShallowCopy creates a shallow copy of this Bootstrapper in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned Bootstrapper can be used concurrently.
type Parameters ¶
type Parameters struct { SlotsToCoeffsParameters advanced.EncodingMatrixLiteral EvalModParameters advanced.EvalModLiteral CoeffsToSlotsParameters advanced.EncodingMatrixLiteral H int // Hamming weight of the secret key }
Parameters is a struct for the default bootstrapping parameters
func (*Parameters) MarshalBinary ¶
func (p *Parameters) MarshalBinary() (data []byte, err error)
MarshalBinary encode the target Parameters on a slice of bytes.
func (*Parameters) RotationsForBootstrapping ¶
func (p *Parameters) RotationsForBootstrapping(LogN, LogSlots int) (rotations []int)
RotationsForBootstrapping returns the list of rotations performed during the Bootstrapping operation.
func (*Parameters) UnmarshalBinary ¶
func (p *Parameters) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary decodes a slice of bytes on the target Parameters.