Documentation
¶
Index ¶
- Variables
- func Add(cryptoParams *CryptoParams, ct1 *ckks.Ciphertext, ct2 *ckks.Ciphertext) *ckks.Ciphertext
- func AddConst(cryptoParams *CryptoParams, ct *ckks.Ciphertext, constant interface{}) *ckks.Ciphertext
- func AddPlain(cryptoParams *CryptoParams, ct1 *ckks.Ciphertext, ct2 *ckks.Plaintext) *ckks.Ciphertext
- func AggregateSumMask(cryptoParams *CryptoParams, vals []*ckks.Ciphertext) *ckks.Ciphertext
- func ConvertVectorComplexToFloat64(v []complex128) []float64
- func ConvertVectorFloat64ToComplex(v []float64) []complex128
- func DecodeFloatVector(cryptoParams *CryptoParams, fEncoded PlainVector) []float64
- func DecryptFloat(cryptoParams *CryptoParams, cipher *ckks.Ciphertext) float64
- func DecryptFloatMatrix(cryptoParams *CryptoParams, matrixEnc []CipherVector, d int) [][]float64
- func DecryptFloatVector(cryptoParams *CryptoParams, fEnc CipherVector, N int) []float64
- func DecryptMultipleFloat(cryptoParams *CryptoParams, cipher *ckks.Ciphertext, nbrEl int) []float64
- func EncryptFloat(cryptoParams *CryptoParams, num float64) *ckks.Ciphertext
- func FindClosestPow2(n int) int
- func GetCTsize(vecsize, ctind, slots int) int
- func GlobalToPartyIndex(cryptoParams *CryptoParams, Arowdims []int, col, nparty int) (int, int, int)
- func InnerProd(cryptoParams *CryptoParams, X, Y CipherVector) *ckks.Ciphertext
- func InnerSum(cryptoParams *CryptoParams, X CipherVector, Xsize int) *ckks.Ciphertext
- func InnerSumAll(cryptoParams *CryptoParams, X CipherVector) *ckks.Ciphertext
- func InvApprox(cryptoParams *CryptoParams, ctIn *ckks.Ciphertext, intv IntervalApprox) *ckks.Ciphertext
- func InvSqrtApprox(cryptoParams *CryptoParams, ctIn *ckks.Ciphertext, intv IntervalApprox) *ckks.Ciphertext
- func MarshalCM(cm CipherMatrix) ([]byte, []byte)
- func Mask(cryptoParams *CryptoParams, ct *ckks.Ciphertext, index int, keepRest bool) *ckks.Ciphertext
- func MaskTrunc(cryptoParams *CryptoParams, ct *ckks.Ciphertext, N int) *ckks.Ciphertext
- func MaskWithScaling(cryptoParams *CryptoParams, ct *ckks.Ciphertext, ind int, keep bool, ...) *ckks.Ciphertext
- func Max(x, y int) int
- func Min(a int, b int) int
- func Mod(n int, modulus int) int
- func Mult(cryptoParams *CryptoParams, ct1 *ckks.Ciphertext, ct2 *ckks.Ciphertext) *ckks.Ciphertext
- func PadVector(v []float64, slots int) []float64
- func PlaintextToDense(cryptoParams *CryptoParams, pt PlainMatrix, ptVecSize int) *mat.Dense
- func Rebalance(cryptoParams *CryptoParams, ct *ckks.Ciphertext) *ckks.Ciphertext
- func RotateAndAdd(cryptoParams *CryptoParams, ct *ckks.Ciphertext, size int) *ckks.Ciphertext
- func RotateAndPlace(cryptoParams *CryptoParams, ct *ckks.Ciphertext, size, place int, ...) *ckks.Ciphertext
- func RotateRight(cryptoParams *CryptoParams, ct *ckks.Ciphertext, nrot int) *ckks.Ciphertext
- func RotateRightWithEvaluator(cryptoParams *CryptoParams, ct *ckks.Ciphertext, nrot int, eva ckks.Evaluator) *ckks.Ciphertext
- func SaveCipherMatrixToFile(cps *CryptoParams, cm CipherMatrix, filename string)
- func SqSum(cryptoParams *CryptoParams, X CipherVector) *ckks.Ciphertext
- func Sqrt(x complex128) complex128
- func SqrtApprox(cryptoParams *CryptoParams, ctIn *ckks.Ciphertext, intv IntervalApprox) *ckks.Ciphertext
- func Zero(cryptoParams *CryptoParams) *ckks.Ciphertext
- type CipherMatrix
- func AggregateMat(cryptoParams *CryptoParams, mats []CipherMatrix) CipherMatrix
- func CMatRescale(cryptoParams *CryptoParams, X CipherMatrix) CipherMatrix
- func CMultConstMat(cryptoParams *CryptoParams, X CipherMatrix, constant interface{}, inPlace bool) (res CipherMatrix)
- func CZeroMat(cryptoParams *CryptoParams, nrows, ncols int) CipherMatrix
- func ConcatCipherMatrix(mats []CipherMatrix) CipherMatrix
- func DCopyEncrypted(A []CipherMatrix) []CipherMatrix
- func DropLevel(cryptoParams *CryptoParams, A CipherMatrix, outLevel int) CipherMatrix
- func DummyBootstrapMatrix(cryptoParams *CryptoParams, Ap CipherMatrix) CipherMatrix
- func EncryptDense(cryptoParams *CryptoParams, vals *mat.Dense) CipherMatrix
- func EncryptFloatMatrixRow(cryptoParams *CryptoParams, matrix [][]float64) (CipherMatrix, int, int, error)
- func EncryptPlaintextMatrix(cryptoParams *CryptoParams, pm PlainMatrix) CipherMatrix
- func FlattenLevels(cryptoParams *CryptoParams, X CipherMatrix) (CipherMatrix, int)
- func InitEncryptedMatrix(cryptoParams *CryptoParams, dy int, dx int) (CipherMatrix, int, int, error)
- func LevelTestMatrix(ciphers CipherMatrix, cryptoParams *CryptoParams, needed int, ...) CipherMatrix
- func LoadCipherMatrixFromFile(cps *CryptoParams, filename string) CipherMatrix
- func UnmarshalCM(cryptoParams *CryptoParams, r, c int, sbytes, ctbytes []byte) CipherMatrix
- type CipherVector
- func AggregateVec(cryptoParams *CryptoParams, vecs []CipherVector) CipherVector
- func CAdd(cryptoParams *CryptoParams, X CipherVector, Y CipherVector) CipherVector
- func CAddConst(cryptoParams *CryptoParams, X CipherVector, constant interface{}) CipherVector
- func CInverse(cryptoParams *CryptoParams, X CipherVector, intv IntervalApprox) CipherVector
- func CMask(cryptoParams *CryptoParams, cv CipherVector, index int, keepRest bool) CipherVector
- func CMult(cryptoParams *CryptoParams, X CipherVector, Y CipherVector) CipherVector
- func CMultConst(cryptoParams *CryptoParams, X CipherVector, constant interface{}, inPlace bool) (res CipherVector)
- func CMultConstRescale(cryptoParams *CryptoParams, X CipherVector, constant interface{}, inPlace bool) CipherVector
- func CMultScalar(cryptoParams *CryptoParams, X CipherVector, ct *ckks.Ciphertext) CipherVector
- func CPAdd(cryptoParams *CryptoParams, X CipherVector, Y PlainVector) CipherVector
- func CPMult(cryptoParams *CryptoParams, X CipherVector, Y PlainVector) CipherVector
- func CPSubOther(cryptoParams *CryptoParams, X PlainVector, Y CipherVector) CipherVector
- func CReal(cps *CryptoParams, Z CipherVector) (real CipherVector)
- func CRescale(cryptoParams *CryptoParams, X CipherVector) CipherVector
- func CSub(cryptoParams *CryptoParams, X CipherVector, Y CipherVector) CipherVector
- func CZeros(cryptoParams *CryptoParams, n int) CipherVector
- func ChebyApproximation(cryptoParams *CryptoParams, X CipherVector, cheby *ckks.ChebyshevInterpolation) CipherVector
- func ComplexConjugate(cryptoParams *CryptoParams, X CipherVector) CipherVector
- func CopyEncryptedMatrix(src []CipherVector) []CipherVector
- func CopyEncryptedVector(src CipherVector) CipherVector
- func EncryptFloatVector(cryptoParams *CryptoParams, f []float64) (CipherVector, int)
- func LevelTest(ciphers CipherVector, cryptoParams *CryptoParams, needed int, ...) CipherVector
- type CryptoParams
- func (cp *CryptoParams) GetPrec() uint
- func (cp *CryptoParams) GetSlots() int
- func (cp *CryptoParams) MarshalBinary() ([]byte, error)
- func (cp *CryptoParams) SetDecryptors(params *ckks.Parameters, sk *ckks.SecretKey)
- func (cp *CryptoParams) SetEvaluators(params *ckks.Parameters, rlk *ckks.RelinearizationKey, ...)
- func (cp *CryptoParams) SetRotKeys(nbrRot []RotationType) []int
- func (cp *CryptoParams) UnmarshalBinary(data []byte) error
- func (cp *CryptoParams) WithDecryptor(act func(act ckks.Decryptor) error) error
- func (cp *CryptoParams) WithEncoder(act func(ckks.Encoder) error) error
- func (cp *CryptoParams) WithEncryptor(act func(ckks.Encryptor) error) error
- func (cp *CryptoParams) WithEvaluator(act func(ckks.Evaluator) error) error
- type CryptoParamsForNetwork
- type IntervalApprox
- type PlainMatrix
- type PlainVector
- type RotationType
Constants ¶
This section is empty.
Variables ¶
var SideLeft = false
var SideRight = true
Functions ¶
func Add ¶
func Add(cryptoParams *CryptoParams, ct1 *ckks.Ciphertext, ct2 *ckks.Ciphertext) *ckks.Ciphertext
func AddConst ¶
func AddConst(cryptoParams *CryptoParams, ct *ckks.Ciphertext, constant interface{}) *ckks.Ciphertext
func AddPlain ¶
func AddPlain(cryptoParams *CryptoParams, ct1 *ckks.Ciphertext, ct2 *ckks.Plaintext) *ckks.Ciphertext
func AggregateSumMask ¶
func AggregateSumMask(cryptoParams *CryptoParams, vals []*ckks.Ciphertext) *ckks.Ciphertext
AggregateSumMask sums across parties
func ConvertVectorComplexToFloat64 ¶
func ConvertVectorComplexToFloat64(v []complex128) []float64
ConvertVectorComplexToFloat64 converts an array of complex to float
func ConvertVectorFloat64ToComplex ¶
func ConvertVectorFloat64ToComplex(v []float64) []complex128
ConvertVectorFloat64ToComplex converts an array of floats to complex
func DecodeFloatVector ¶
func DecodeFloatVector(cryptoParams *CryptoParams, fEncoded PlainVector) []float64
DecodeFloatVector decodes a slice of plaintext values in multiple float64 values.
func DecryptFloat ¶
func DecryptFloat(cryptoParams *CryptoParams, cipher *ckks.Ciphertext) float64
DecryptFloat decrypts a ciphertext with one float64 value.
func DecryptFloatMatrix ¶
func DecryptFloatMatrix(cryptoParams *CryptoParams, matrixEnc []CipherVector, d int) [][]float64
DecryptFloatMatrix decrypts a matrix (kind of) of multiple packed ciphertexts. For this specific matrix decryption each row is encrypted in a set of ciphertexts. d is the number of column values
func DecryptFloatVector ¶
func DecryptFloatVector(cryptoParams *CryptoParams, fEnc CipherVector, N int) []float64
DecryptFloatVector decrypts multiple batched ciphertexts with N float64 values and appends all data into one single float vector. If nbrEl<=0 it decrypts everything without caring about the number of encrypted values. If nbrEl>0 the function returns N elements from the decryption.
func DecryptMultipleFloat ¶
func DecryptMultipleFloat(cryptoParams *CryptoParams, cipher *ckks.Ciphertext, nbrEl int) []float64
DecryptMultipleFloat decrypts a ciphertext with multiple float64 values. If nbrEl<=0 it decrypts everything without caring about the number of encrypted values. If nbrEl>0 the function returns N elements from the decryption.
func EncryptFloat ¶
func EncryptFloat(cryptoParams *CryptoParams, num float64) *ckks.Ciphertext
EncryptFloat encrypts one float64 value.
func FindClosestPow2 ¶
FindClosestPow2 finds the closest power of 2 bigger than a number n
func GlobalToPartyIndex ¶
func InnerProd ¶
func InnerProd(cryptoParams *CryptoParams, X, Y CipherVector) *ckks.Ciphertext
func InnerSum ¶
func InnerSum(cryptoParams *CryptoParams, X CipherVector, Xsize int) *ckks.Ciphertext
func InnerSumAll ¶
func InnerSumAll(cryptoParams *CryptoParams, X CipherVector) *ckks.Ciphertext
func InvApprox ¶
func InvApprox(cryptoParams *CryptoParams, ctIn *ckks.Ciphertext, intv IntervalApprox) *ckks.Ciphertext
InvApprox computes an encrypted approximated version of the inverse function
func InvSqrtApprox ¶
func InvSqrtApprox(cryptoParams *CryptoParams, ctIn *ckks.Ciphertext, intv IntervalApprox) *ckks.Ciphertext
InvSqrtApprox computes an encrypted approximated version of the inverse function
func MarshalCM ¶
func MarshalCM(cm CipherMatrix) ([]byte, []byte)
MarshalCiphermatrix returns byte array corresponding to ciphertext sizes (int array) and byte array corresponding to marshaling
func Mask ¶
func Mask(cryptoParams *CryptoParams, ct *ckks.Ciphertext, index int, keepRest bool) *ckks.Ciphertext
func MaskTrunc ¶
func MaskTrunc(cryptoParams *CryptoParams, ct *ckks.Ciphertext, N int) *ckks.Ciphertext
Retain only the first N slots TODO is there a way to do this without consuming a level?
func MaskWithScaling ¶
func MaskWithScaling(cryptoParams *CryptoParams, ct *ckks.Ciphertext, ind int, keep bool, scalingFactor float64) *ckks.Ciphertext
func Mult ¶
func Mult(cryptoParams *CryptoParams, ct1 *ckks.Ciphertext, ct2 *ckks.Ciphertext) *ckks.Ciphertext
func PlaintextToDense ¶
func PlaintextToDense(cryptoParams *CryptoParams, pt PlainMatrix, ptVecSize int) *mat.Dense
Takes PlaintextMatrix and returns a denseMatrix: if col is true (ie pt is a column encoded matrix, then we transpose)
func Rebalance ¶
func Rebalance(cryptoParams *CryptoParams, ct *ckks.Ciphertext) *ckks.Ciphertext
func RotateAndAdd ¶
func RotateAndAdd(cryptoParams *CryptoParams, ct *ckks.Ciphertext, size int) *ckks.Ciphertext
RotateAndAdd computes the inner sum of a Ciphertext
func RotateAndPlace ¶
func RotateAndPlace(cryptoParams *CryptoParams, ct *ckks.Ciphertext, size, place int, duplicate bool) *ckks.Ciphertext
RotateAndPlace rotates ct to the right by shift = place
func RotateRight ¶
func RotateRight(cryptoParams *CryptoParams, ct *ckks.Ciphertext, nrot int) *ckks.Ciphertext
func RotateRightWithEvaluator ¶
func RotateRightWithEvaluator(cryptoParams *CryptoParams, ct *ckks.Ciphertext, nrot int, eva ckks.Evaluator) *ckks.Ciphertext
func SaveCipherMatrixToFile ¶
func SaveCipherMatrixToFile(cps *CryptoParams, cm CipherMatrix, filename string)
func SqSum ¶
func SqSum(cryptoParams *CryptoParams, X CipherVector) *ckks.Ciphertext
SqSum evaluates the sum(X^2) across the vector
func Sqrt ¶
func Sqrt(x complex128) complex128
func SqrtApprox ¶
func SqrtApprox(cryptoParams *CryptoParams, ctIn *ckks.Ciphertext, intv IntervalApprox) *ckks.Ciphertext
SqrtApprox computes an encrypted approximated version of the inverse function
Types ¶
type CipherMatrix ¶
type CipherMatrix []CipherVector
CipherMatrix is a slice of slice of Ciphertexts
func AggregateMat ¶
func AggregateMat(cryptoParams *CryptoParams, mats []CipherMatrix) CipherMatrix
func CMatRescale ¶
func CMatRescale(cryptoParams *CryptoParams, X CipherMatrix) CipherMatrix
func CMultConstMat ¶
func CMultConstMat(cryptoParams *CryptoParams, X CipherMatrix, constant interface{}, inPlace bool) (res CipherMatrix)
func CZeroMat ¶
func CZeroMat(cryptoParams *CryptoParams, nrows, ncols int) CipherMatrix
column based
func ConcatCipherMatrix ¶
func ConcatCipherMatrix(mats []CipherMatrix) CipherMatrix
func DCopyEncrypted ¶
func DCopyEncrypted(A []CipherMatrix) []CipherMatrix
DCopyEncrypted returns a shallow? copy of A?
func DropLevel ¶
func DropLevel(cryptoParams *CryptoParams, A CipherMatrix, outLevel int) CipherMatrix
func DummyBootstrapMatrix ¶
func DummyBootstrapMatrix(cryptoParams *CryptoParams, Ap CipherMatrix) CipherMatrix
func EncryptDense ¶
func EncryptDense(cryptoParams *CryptoParams, vals *mat.Dense) CipherMatrix
func EncryptFloatMatrixRow ¶
func EncryptFloatMatrixRow(cryptoParams *CryptoParams, matrix [][]float64) (CipherMatrix, int, int, error)
EncryptFloatMatrixRow encrypts a matrix of float64 to multiple packed ciphertexts. For this specific matrix encryption each row is encrypted in a set of ciphertexts.
func EncryptPlaintextMatrix ¶
func EncryptPlaintextMatrix(cryptoParams *CryptoParams, pm PlainMatrix) CipherMatrix
func FlattenLevels ¶
func FlattenLevels(cryptoParams *CryptoParams, X CipherMatrix) (CipherMatrix, int)
func InitEncryptedMatrix ¶
func InitEncryptedMatrix(cryptoParams *CryptoParams, dy int, dx int) (CipherMatrix, int, int, error)
Initializes a new encrypted matrix with dy rows and dx columns.
func LevelTestMatrix ¶
func LevelTestMatrix(ciphers CipherMatrix, cryptoParams *CryptoParams, needed int, serverID, name string) CipherMatrix
func LoadCipherMatrixFromFile ¶
func LoadCipherMatrixFromFile(cps *CryptoParams, filename string) CipherMatrix
func UnmarshalCM ¶
func UnmarshalCM(cryptoParams *CryptoParams, r, c int, sbytes, ctbytes []byte) CipherMatrix
MarshalCiphermatrix returns byte array corresponding to ciphertext sizes (int array) and byte array corresponding to marshaling
func (*CipherMatrix) MarshalBinary ¶
func (cm *CipherMatrix) MarshalBinary() ([]byte, [][]int, error)
func (*CipherMatrix) UnmarshalBinary ¶
func (cm *CipherMatrix) UnmarshalBinary(cryptoParams *CryptoParams, f []byte, ctSizes [][]int) error
type CipherVector ¶
type CipherVector []*ckks.Ciphertext
CipherVector is a slice of Ciphertexts
func AggregateVec ¶
func AggregateVec(cryptoParams *CryptoParams, vecs []CipherVector) CipherVector
func CAdd ¶
func CAdd(cryptoParams *CryptoParams, X CipherVector, Y CipherVector) CipherVector
func CAddConst ¶
func CAddConst(cryptoParams *CryptoParams, X CipherVector, constant interface{}) CipherVector
func CInverse ¶
func CInverse(cryptoParams *CryptoParams, X CipherVector, intv IntervalApprox) CipherVector
func CMask ¶
func CMask(cryptoParams *CryptoParams, cv CipherVector, index int, keepRest bool) CipherVector
Masks out one or multiple values in a ciphervector.
func CMult ¶
func CMult(cryptoParams *CryptoParams, X CipherVector, Y CipherVector) CipherVector
func CMultConst ¶
func CMultConst(cryptoParams *CryptoParams, X CipherVector, constant interface{}, inPlace bool) (res CipherVector)
func CMultConstRescale ¶
func CMultConstRescale(cryptoParams *CryptoParams, X CipherVector, constant interface{}, inPlace bool) CipherVector
func CMultScalar ¶
func CMultScalar(cryptoParams *CryptoParams, X CipherVector, ct *ckks.Ciphertext) CipherVector
func CPAdd ¶
func CPAdd(cryptoParams *CryptoParams, X CipherVector, Y PlainVector) CipherVector
func CPMult ¶
func CPMult(cryptoParams *CryptoParams, X CipherVector, Y PlainVector) CipherVector
func CPSubOther ¶
func CPSubOther(cryptoParams *CryptoParams, X PlainVector, Y CipherVector) CipherVector
Subtracts a ciphervector from a plaintext vector.
func CReal ¶
func CReal(cps *CryptoParams, Z CipherVector) (real CipherVector)
Returns the real component of a CipherVector.
func CRescale ¶
func CRescale(cryptoParams *CryptoParams, X CipherVector) CipherVector
func CSub ¶
func CSub(cryptoParams *CryptoParams, X CipherVector, Y CipherVector) CipherVector
func CZeros ¶
func CZeros(cryptoParams *CryptoParams, n int) CipherVector
func ChebyApproximation ¶
func ChebyApproximation(cryptoParams *CryptoParams, X CipherVector, cheby *ckks.ChebyshevInterpolation) CipherVector
func ComplexConjugate ¶
func ComplexConjugate(cryptoParams *CryptoParams, X CipherVector) CipherVector
Returns the complex conjugate of a ciphervector.
func CopyEncryptedMatrix ¶
func CopyEncryptedMatrix(src []CipherVector) []CipherVector
CopyEncryptedMatrix does a copy of a matrix of ciphertexts to a newly created array
func CopyEncryptedVector ¶
func CopyEncryptedVector(src CipherVector) CipherVector
CopyEncryptedVector does a copy of an array of ciphertexts to a newly created array
func EncryptFloatVector ¶
func EncryptFloatVector(cryptoParams *CryptoParams, f []float64) (CipherVector, int)
EncryptFloatVector encrypts a slice of float64 values in multiple batched ciphertexts. and return the number of encrypted elements.
func LevelTest ¶
func LevelTest(ciphers CipherVector, cryptoParams *CryptoParams, needed int, serverID, name string) CipherVector
func (*CipherVector) DummyBootstrapping ¶
func (cv *CipherVector) DummyBootstrapping(serverID string, cryptoParams *CryptoParams) CipherVector
DummyBootstrapping mimics the bootstrapping
func (*CipherVector) MarshalBinary ¶
func (cv *CipherVector) MarshalBinary() ([]byte, []int, error)
func (*CipherVector) UnmarshalBinary ¶
func (cv *CipherVector) UnmarshalBinary(cryptoParams *CryptoParams, f []byte, fSizes []int) error
UnmarshalBinary -> CipherVector: converts an array of bytes to an array of ciphertexts.
type CryptoParams ¶
type CryptoParams struct { Sk *ckks.SecretKey AggregateSk *ckks.SecretKey Pk *ckks.PublicKey Rlk *ckks.RelinearizationKey RotKs *ckks.RotationKeySet Params *ckks.Parameters // contains filtered or unexported fields }
CryptoParams aggregates all ckks scheme information
func NewCryptoParams ¶
func NewCryptoParams(params *ckks.Parameters, sk, aggregateSk *ckks.SecretKey, pk *ckks.PublicKey, rlk *ckks.RelinearizationKey, prec uint, numThreads int) *CryptoParams
NewCryptoParams initializes CryptoParams with the given values
func NewCryptoParamsForNetwork ¶
func NewCryptoParamsForNetwork(params *ckks.Parameters, nbrNodes int, prec uint) []*CryptoParams
NewCryptoParamsForNetwork initializes a set of nbrNodes CryptoParams each containing: keys, encoder, encryptor, decryptor, etc.
func (*CryptoParams) GetPrec ¶
func (cp *CryptoParams) GetPrec() uint
func (*CryptoParams) GetSlots ¶
func (cp *CryptoParams) GetSlots() int
GetSlots gets the number of encodable slots (N/2)
func (*CryptoParams) MarshalBinary ¶
func (cp *CryptoParams) MarshalBinary() ([]byte, error)
MarshalBinary for minimal cryptoParams-keys + params
func (*CryptoParams) SetDecryptors ¶
func (cp *CryptoParams) SetDecryptors(params *ckks.Parameters, sk *ckks.SecretKey)
SetDecryptors sets the decryptors in the CryptoParams object
func (*CryptoParams) SetEvaluators ¶
func (cp *CryptoParams) SetEvaluators(params *ckks.Parameters, rlk *ckks.RelinearizationKey, rtks *ckks.RotationKeySet)
func (*CryptoParams) SetRotKeys ¶
func (cp *CryptoParams) SetRotKeys(nbrRot []RotationType) []int
SetRotKeys sets/adds new rotation keys
func (*CryptoParams) UnmarshalBinary ¶
func (cp *CryptoParams) UnmarshalBinary(data []byte) error
func (*CryptoParams) WithDecryptor ¶
func (cp *CryptoParams) WithDecryptor(act func(act ckks.Decryptor) error) error
WithDecryptor run the given function with a decryptor
func (*CryptoParams) WithEncoder ¶
func (cp *CryptoParams) WithEncoder(act func(ckks.Encoder) error) error
WithEncoder run the given function with an encoder
func (*CryptoParams) WithEncryptor ¶
func (cp *CryptoParams) WithEncryptor(act func(ckks.Encryptor) error) error
WithEncryptor run the given function with an encryptor
func (*CryptoParams) WithEvaluator ¶
func (cp *CryptoParams) WithEvaluator(act func(ckks.Evaluator) error) error
WithEvaluator run the given function with an evaluator
type CryptoParamsForNetwork ¶
type CryptoParamsForNetwork struct {
// contains filtered or unexported fields
}
CryptoParamsForNetwork stores all crypto info to save to file
type IntervalApprox ¶
type PlainMatrix ¶
type PlainMatrix []PlainVector
PlainMatrix is a slice of slice of Plaintexts
func EncodeDense ¶
func EncodeDense(cryptoParams *CryptoParams, vals *mat.Dense) PlainMatrix
func EncodeFloatMatrixRow ¶
func EncodeFloatMatrixRow(cryptoParams *CryptoParams, matrix [][]float64) (PlainMatrix, int, int, error)
EncodeFloatMatrixRow encodes a matrix of float64 to multiple packed plaintexts. For this specific matrix encoding each row is encoded in a set of plaintexts.
type PlainVector ¶
PlainVector is a slice of Plaintexts
func EncodeFloatVector ¶
func EncodeFloatVector(cryptoParams *CryptoParams, f []float64) (PlainVector, int)
EncodeFloatVector encodes a slice of float64 values in multiple batched plaintext (ready to be encrypted). It also returns the number of encoded elements.
func EncodeFloatVectorWithScale ¶
func EncodeFloatVectorWithScale(cryptoParams *CryptoParams, f []float64, scale float64) (PlainVector, int)
EncodeFloatVector encodes a slice of float64 values in multiple batched plaintext (ready to be encrypted). It also returns the number of encoded elements.
type RotationType ¶
RotationType defines how much we should rotate and in which direction
func GenerateRotKeys ¶
func GenerateRotKeys(slots int, smallDim int, babyFlag bool) []RotationType
Generate rotKeys for power of two shifts up to # of slots and for every shift up to smallDim