Versions in this module Expand all Collapse all v0 v0.2.0 May 16, 2023 v0.1.10 Aug 3, 2023 v0.1.9 Aug 2, 2023 v0.1.8 Aug 2, 2023 Changes in this version type Parameters + func (p Parameters) Delta() uint64 + func (p Parameters) DeltaMForm() uint64 v0.1.7 Jul 30, 2023 v0.1.6 Mar 14, 2023 v0.1.5 Mar 8, 2023 Changes in this version type Parameters + func (p Parameters) PrimitiveRoots() []uint64 v0.1.3 Dec 16, 2022 v0.1.2 Dec 15, 2022 Changes in this version + type LPEncryptor interface + MarshalEncParams func() ([]byte, []byte, []byte) v0.1.1 Dec 15, 2022 v0.1.0 Dec 14, 2022 Changes in this version + const DefaultSigma + const GaloisGen + const MaxLogN + const MaxModuliCount + const MaxModuliSize + const MinLogN + const ScalePrecision + var DefaultParams = []ParametersLiteral + var TestPN10QP27 = ParametersLiteral + var TestPN11QP54 = ParametersLiteral + var TestPN12QP109 = ParametersLiteral + var TestPN13QP218 = ParametersLiteral + var TestPN14QP438 = ParametersLiteral + var TestPN15QP880 = ParametersLiteral + var TestPN16QP240 = ParametersLiteral + var TestPN17QP360 = ParametersLiteral + func AddPolyTimesGadgetVectorToGadgetCiphertext(pt *ring.Poly, cts []GadgetCiphertext, ringQP ringqp.Ring, logbase2 int, ...) + func AddPolyToGadgetMatrix(pt *ring.Poly, gm [][]ringqp.Poly, ringQP ringqp.Ring, logbase2 int, ...) + func CheckModuli(q, p []uint64) error + func GenModuli(logN int, logQ, logP []int) (q, p []uint64, err error) + func Norm(ct *Ciphertext, dec Decryptor) (std, min, max float64) + func NormStats(vec []*big.Int) (float64, float64, float64) + func PopulateElementRandom(prng utils.PRNG, params Parameters, ct *Ciphertext) + func PublicKeyIsCorrect(pk *PublicKey, sk *SecretKey, params Parameters, log2Bound int) bool + func RelinearizationKeyIsCorrect(rlk *SwitchingKey, skIdeal *SecretKey, params Parameters, log2Bound int) bool + func RotationKeyIsCorrect(swk *SwitchingKey, galEl uint64, skIdeal *SecretKey, params Parameters, ...) bool + func SwitchCiphertextRingDegree(ctIn *Ciphertext, ctOut *Ciphertext) + func SwitchCiphertextRingDegreeNTT(ctIn *Ciphertext, ringQSmallDim, ringQLargeDim *ring.Ring, ctOut *Ciphertext) + func SwitchingKeyIsCorrect(swk *SwitchingKey, skIn, skOut *SecretKey, params Parameters, log2Bound int) bool + type AdditiveShare struct + Value ring.Poly + func NewAdditiveShare(params Parameters) *AdditiveShare + func NewAdditiveShareAtLevel(params Parameters, level int) *AdditiveShare + type AdditiveShareBigint struct + Value []*big.Int + func NewAdditiveShareBigint(params Parameters, n int) *AdditiveShareBigint + type Ciphertext struct + Value []*ring.Poly + func GetSmallestLargest(el0, el1 *Ciphertext) (smallest, largest *Ciphertext, sameDegree bool) + func NewCiphertext(params Parameters, degree, level int) (ct *Ciphertext) + func NewCiphertextAtLevelFromPoly(level int, poly [2]*ring.Poly) (ct *Ciphertext) + func NewCiphertextRandom(prng utils.PRNG, params Parameters, degree, level int) (ciphertext *Ciphertext) + func (ct *Ciphertext) Copy(ctxCopy *Ciphertext) + func (ct *Ciphertext) CopyNew() *Ciphertext + func (ct *Ciphertext) Decode64(data []byte) (ptr int, err error) + func (ct *Ciphertext) Degree() int + func (ct *Ciphertext) El() *Ciphertext + func (ct *Ciphertext) Encode64(data []byte) (ptr int, err error) + func (ct *Ciphertext) GetScale() Scale + func (ct *Ciphertext) Level() int + func (ct *Ciphertext) MarshalBinary() (data []byte, err error) + func (ct *Ciphertext) MarshalBinarySize() (dataLen int) + func (ct *Ciphertext) Resize(degree, level int) + func (ct *Ciphertext) SetScale(scale Scale) + func (ct *Ciphertext) UnmarshalBinary(data []byte) (err error) + type CiphertextQP struct + Value [2]ringqp.Poly + func (ct *CiphertextQP) CopyNew() *CiphertextQP + func (ct *CiphertextQP) Decode64(data []byte) (ptr int, err error) + func (ct *CiphertextQP) Encode64(data []byte) (ptr int, err error) + func (ct *CiphertextQP) MarshalBinarySize() int + type Decryptor interface + Decrypt func(ct *Ciphertext, pt *Plaintext) + DecryptNew func(ct *Ciphertext) (pt *Plaintext) + ShallowCopy func() Decryptor + WithKey func(sk *SecretKey) Decryptor + func NewDecryptor(params Parameters, sk *SecretKey) Decryptor + type Encryptor interface + Encrypt func(pt *Plaintext, ct interface{}) + EncryptNew func(pt *Plaintext) (ct *Ciphertext) + EncryptZero func(ct interface{}) + EncryptZeroNew func(level int) (ct *Ciphertext) + ShallowCopy func() Encryptor + WithKey func(key interface{}) Encryptor + func NewEncryptor(params Parameters, key interface{}) Encryptor + func NewLPEncryptor(params Parameters, key *PublicKey) Encryptor + type EvaluationKey struct + Rlk *RelinearizationKey + Rtks *RotationKeySet + type Evaluator struct + BasisExtender *ring.BasisExtender + Decomposer *ring.Decomposer + PermuteNTTIndex map[uint64][]uint64 + Rlk *RelinearizationKey + Rtks *RotationKeySet + func NewEvaluator(params Parameters, evaluationKey *EvaluationKey) (eval *Evaluator) + func (eval *Evaluator) Automorphism(ctIn *Ciphertext, galEl uint64, ctOut *Ciphertext) + func (eval *Evaluator) AutomorphismHoisted(level int, ctIn *Ciphertext, c1DecompQP []ringqp.Poly, galEl uint64, ...) + func (eval *Evaluator) AutomorphismHoistedNoModDown(levelQ int, c0 *ring.Poly, c1DecompQP []ringqp.Poly, galEl uint64, ...) + func (eval *Evaluator) DecomposeNTT(levelQ, levelP, nbPi int, c2 *ring.Poly, c2IsNTT bool, ...) + func (eval *Evaluator) DecomposeSingleNTT(levelQ, levelP, nbPi, decompRNS int, c2NTT, c2InvNTT, c2QiQ, c2QiP *ring.Poly) + func (eval *Evaluator) Expand(ctIn *Ciphertext, logN, logGap int) (ctOut []*Ciphertext) + func (eval *Evaluator) GadgetProduct(levelQ int, cx *ring.Poly, gadgetCt GadgetCiphertext, ct *Ciphertext) + func (eval *Evaluator) GadgetProductNoModDown(levelQ int, cx *ring.Poly, gadgetCt GadgetCiphertext, ct CiphertextQP) + func (eval *Evaluator) GadgetProductSinglePAndBitDecompNoModDown(levelQ int, cx *ring.Poly, gadgetCt GadgetCiphertext, ct CiphertextQP) + func (eval *Evaluator) InnerSum(ctIn *Ciphertext, batchSize, n int, ctOut *Ciphertext) + func (eval *Evaluator) KeyswitchHoisted(levelQ int, BuffQPDecompQP []ringqp.Poly, evakey *SwitchingKey, ...) + func (eval *Evaluator) KeyswitchHoistedNoModDown(levelQ int, BuffQPDecompQP []ringqp.Poly, evakey *SwitchingKey, ...) + func (eval *Evaluator) Merge(ctIn map[int]*Ciphertext) (ctOut *Ciphertext) + func (eval *Evaluator) Parameters() Parameters + func (eval *Evaluator) Relinearize(ctIn *Ciphertext, ctOut *Ciphertext) + func (eval *Evaluator) Replicate(ctIn *Ciphertext, batchSize, n int, ctOut *Ciphertext) + func (eval *Evaluator) ShallowCopy() *Evaluator + func (eval *Evaluator) SwitchKeys(ctIn *Ciphertext, switchingKey *SwitchingKey, ctOut *Ciphertext) + func (eval *Evaluator) Trace(ctIn *Ciphertext, logN int, ctOut *Ciphertext) + func (eval *Evaluator) WithKey(evaluationKey *EvaluationKey) *Evaluator + type GadgetCiphertext struct + Value [][]CiphertextQP + func NewGadgetCiphertext(levelQ, levelP, decompRNS, decompBIT int, ringQP ringqp.Ring) (ct *GadgetCiphertext) + func (ct *GadgetCiphertext) CopyNew() (ctCopy *GadgetCiphertext) + func (ct *GadgetCiphertext) Decode(data []byte) (ptr int, err error) + func (ct *GadgetCiphertext) Encode(data []byte) (ptr int, err error) + func (ct *GadgetCiphertext) Equals(other *GadgetCiphertext) bool + func (ct *GadgetCiphertext) LevelP() int + func (ct *GadgetCiphertext) LevelQ() int + func (ct *GadgetCiphertext) MarshalBinary() (data []byte, err error) + func (ct *GadgetCiphertext) MarshalBinarySize() (dataLen int) + func (ct *GadgetCiphertext) UnmarshalBinary(data []byte) (err error) + type GadgetPlaintext struct + Value []*ring.Poly + func NewGadgetPlaintext(value interface{}, levelQ, levelP, logBase2, decompBIT int, ringQP ringqp.Ring) (pt *GadgetPlaintext) + type KeyGenerator interface + GenKeyPair func() (sk *SecretKey, pk *PublicKey) + GenPublicKey func(sk *SecretKey) (pk *PublicKey) + GenRelinearizationKey func(sk *SecretKey, maxDegree int) (evk *RelinearizationKey) + GenRotationKeys func(galEls []uint64, sk *SecretKey) (rks *RotationKeySet) + GenRotationKeysForInnerSum func(sk *SecretKey) (rks *RotationKeySet) + GenRotationKeysForRotations func(ks []int, inclueSwapRows bool, sk *SecretKey) (rks *RotationKeySet) + GenSecretKey func() (sk *SecretKey) + GenSecretKeyGaussian func() (sk *SecretKey) + GenSecretKeyWithDistrib func(p float64) (sk *SecretKey) + GenSecretKeyWithHammingWeight func(hw int) (sk *SecretKey) + GenSwitchingKey func(skInput, skOutput *SecretKey) (newevakey *SwitchingKey) + GenSwitchingKeyForGalois func(galEl uint64, sk *SecretKey) (swk *SwitchingKey) + GenSwitchingKeyForRotationBy func(k int, sk *SecretKey) (swk *SwitchingKey) + GenSwitchingKeyForRowRotation func(sk *SecretKey) (swk *SwitchingKey) + GenSwitchingKeysForRingSwap func(skCKKS, skCI *SecretKey) (stdToci, ciToStd *SwitchingKey) + func NewKeyGenerator(params Parameters) KeyGenerator + type MetaData struct + IsMontgomery bool + IsNTT bool + func (m *MetaData) Decode64(data []byte) (ptr int, err error) + func (m *MetaData) Encode64(data []byte) (ptr int, err error) + func (m *MetaData) Equal(other MetaData) (res bool) + func (m *MetaData) MarshalBinary() (data []byte, err error) + func (m *MetaData) MarshalBinarySize() int + func (m *MetaData) UnmarshalBinary(data []byte) (err error) + type Operand interface + Degree func() int + El func() *Ciphertext + GetScale func() Scale + Level func() int + SetScale func(Scale) + type PRNGEncryptor interface + WithPRNG func(prng utils.PRNG) PRNGEncryptor + func NewPRNGEncryptor(params Parameters, key *SecretKey) PRNGEncryptor + type Parameters struct + func NewParameters(logn int, q, p []uint64, pow2Base, h int, sigma float64, ringType ring.Type, ...) (Parameters, error) + func NewParametersFromLiteral(paramDef ParametersLiteral) (Parameters, error) + func (p *Parameters) PiOverflowMargin(level int) int + func (p *Parameters) QiOverflowMargin(level int) int + func (p *Parameters) UnmarshalBinary(data []byte) error + func (p *Parameters) UnmarshalJSON(data []byte) (err error) + func (p Parameters) CopyNew() Parameters + func (p Parameters) DecompPw2(levelQ, levelP int) (c int) + func (p Parameters) DecompRNS(levelQ, levelP int) int + func (p Parameters) DefaultNTTFlag() bool + func (p Parameters) DefaultScale() Scale + func (p Parameters) Equals(other Parameters) bool + func (p Parameters) GaloisElementForColumnRotationBy(k int) uint64 + func (p Parameters) GaloisElementForExpand(logN int) (galEls []uint64) + func (p Parameters) GaloisElementForRowRotation() uint64 + func (p Parameters) GaloisElementsForMerge() (galEls []uint64) + func (p Parameters) GaloisElementsForRowInnerSum() (galEls []uint64) + func (p Parameters) GaloisElementsForTrace(logN int) (galEls []uint64) + func (p Parameters) HammingWeight() int + func (p Parameters) InverseGaloisElement(galEl uint64) uint64 + func (p Parameters) LogN() int + func (p Parameters) LogP() int + func (p Parameters) LogQ() int + func (p Parameters) LogQP() int + func (p Parameters) MarshalBinary() ([]byte, error) + func (p Parameters) MarshalBinarySize() int + func (p Parameters) MarshalJSON() ([]byte, error) + func (p Parameters) MaxBit(levelQ, levelP int) (c int) + func (p Parameters) MaxLevel() int + func (p Parameters) N() int + func (p Parameters) NewScale(scale interface{}) Scale + func (p Parameters) NoiseBound() uint64 + func (p Parameters) P() []uint64 + func (p Parameters) PBigInt() *big.Int + func (p Parameters) PCount() int + func (p Parameters) ParametersLiteral() ParametersLiteral + func (p Parameters) Pow2Base() int + func (p Parameters) Q() []uint64 + func (p Parameters) QBigInt() *big.Int + func (p Parameters) QCount() int + func (p Parameters) QP() []uint64 + func (p Parameters) QPBigInt() *big.Int + func (p Parameters) QPCount() int + func (p Parameters) QiFloat64(level int) float64 + func (p Parameters) RingP() *ring.Ring + func (p Parameters) RingQ() *ring.Ring + func (p Parameters) RingQP() *ringqp.Ring + func (p Parameters) RingType() ring.Type + func (p Parameters) RotationFromGaloisElement(galEl uint64) (k uint64) + func (p Parameters) RotationsForInnerSum(batch, n int) (rotations []int) + func (p Parameters) RotationsForReplicate(batch, n int) (rotations []int) + func (p Parameters) Sigma() float64 + func (p Parameters) StandardParameters() (pci Parameters, err error) + type ParametersLiteral struct + DefaultNTTFlag bool + DefaultScale Scale + H int + LogN int + LogP []int + LogQ []int + P []uint64 + Pow2Base int + Q []uint64 + RingType ring.Type + Sigma float64 + type Plaintext struct + Value *ring.Poly + func NewPlaintext(params Parameters, level int) (pt *Plaintext) + func NewPlaintextAtLevelFromPoly(level int, poly *ring.Poly) (pt *Plaintext) + func (pt *Plaintext) Copy(other *Plaintext) + func (pt *Plaintext) Degree() int + func (pt *Plaintext) El() *Ciphertext + func (pt *Plaintext) GetScale() Scale + func (pt *Plaintext) Level() int + func (pt *Plaintext) SetScale(scale Scale) + type PublicKey struct + func NewPublicKey(params Parameters) (pk *PublicKey) + func (pk *PublicKey) CopyNew() *PublicKey + func (pk *PublicKey) Equals(other *PublicKey) bool + func (pk *PublicKey) LevelP() int + func (pk *PublicKey) LevelQ() int + func (pk *PublicKey) MarshalBinary() (data []byte, err error) + func (pk *PublicKey) MarshalBinarySize() (dataLen int) + func (pk *PublicKey) UnmarshalBinary(data []byte) (err error) + type RelinearizationKey struct + Keys []*SwitchingKey + func NewRelinearizationKey(params Parameters, maxRelinDegree int) (evakey *RelinearizationKey) + func (rlk *RelinearizationKey) CopyNew() *RelinearizationKey + func (rlk *RelinearizationKey) Equals(other *RelinearizationKey) bool + func (rlk *RelinearizationKey) MarshalBinary() (data []byte, err error) + func (rlk *RelinearizationKey) MarshalBinarySize() (dataLen int) + func (rlk *RelinearizationKey) UnmarshalBinary(data []byte) (err error) + type RotationKeySet struct + Keys map[uint64]*SwitchingKey + func NewRotationKeySet(params Parameters, galoisElement []uint64) (rotKey *RotationKeySet) + func (rtks *RotationKeySet) Equals(other *RotationKeySet) bool + func (rtks *RotationKeySet) GetRotationKey(galoisEl uint64) (*SwitchingKey, bool) + func (rtks *RotationKeySet) Includes(other *RotationKeySet) bool + func (rtks *RotationKeySet) MarshalBinary() (data []byte, err error) + func (rtks *RotationKeySet) MarshalBinarySize() (dataLen int) + func (rtks *RotationKeySet) UnmarshalBinary(data []byte) (err error) + type Scale struct + Mod *big.Int + Value big.Float + func NewScale(s interface{}) Scale + func NewScaleModT(s interface{}, mod uint64) Scale + func (s *Scale) Decode(data []byte) (err error) + func (s Scale) Cmp(s1 Scale) (cmp int) + func (s Scale) Div(s1 Scale) Scale + func (s Scale) Encode(data []byte) (err error) + func (s Scale) Float64() float64 + func (s Scale) MarshalBinarySize() int + func (s Scale) Max(s1 Scale) (max Scale) + func (s Scale) Min(s1 Scale) (max Scale) + func (s Scale) Mul(s1 Scale) Scale + func (s Scale) Uint64() uint64 + type SecretKey struct + Value ringqp.Poly + func NewSecretKey(params Parameters) *SecretKey + func (sk *SecretKey) CopyNew() *SecretKey + func (sk *SecretKey) LevelP() int + func (sk *SecretKey) LevelQ() int + func (sk *SecretKey) MarshalBinary() (data []byte, err error) + func (sk *SecretKey) MarshalBinarySize() (dataLen int) + func (sk *SecretKey) UnmarshalBinary(data []byte) (err error) + type SwitchingKey struct + func NewSwitchingKey(params Parameters, levelQ, levelP int) *SwitchingKey + func (swk *SwitchingKey) CopyNew() *SwitchingKey + func (swk *SwitchingKey) Equals(other *SwitchingKey) bool + func (swk *SwitchingKey) MarshalBinary() (data []byte, err error) + func (swk *SwitchingKey) UnmarshalBinary(data []byte) (err error)