Documentation ¶
Overview ¶
Package heint implements Homomorphic Encryption for encrypted modular arithmetic over the integers.
Index ¶
- func EncodeLinearTransformation[T Integer](ecd *Encoder, diagonals Diagonals[T], allocated LinearTransformation) (err error)
- func GaloisElementsForLinearTransformation(params rlwe.ParameterProvider, lt LinearTransformationParameters) (galEls []uint64)
- func NewCiphertext(params Parameters, degree, level int) *rlwe.Ciphertext
- func NewDecryptor(params Parameters, key *rlwe.SecretKey) *rlwe.Decryptor
- func NewEncryptor(params Parameters, key rlwe.EncryptionKey) *rlwe.Encryptor
- func NewKeyGenerator(params Parameters) *rlwe.KeyGenerator
- func NewPlaintext(params Parameters, level int) *rlwe.Plaintext
- func NewPowerBasis(ct *rlwe.Ciphertext) he.PowerBasis
- type CoefficientGetter
- type Diagonals
- type Encoder
- type Evaluator
- type Integer
- type LinearTransformation
- type LinearTransformationEvaluator
- func (eval LinearTransformationEvaluator) Evaluate(ctIn *rlwe.Ciphertext, linearTransformation LinearTransformation, ...) (err error)
- func (eval LinearTransformationEvaluator) EvaluateMany(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation, ...) (err error)
- func (eval LinearTransformationEvaluator) EvaluateManyNew(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation) (opOut []*rlwe.Ciphertext, err error)
- func (eval LinearTransformationEvaluator) EvaluateNew(ctIn *rlwe.Ciphertext, linearTransformation LinearTransformation) (opOut *rlwe.Ciphertext, err error)
- func (eval LinearTransformationEvaluator) EvaluateSequential(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation, ...) (err error)
- func (eval LinearTransformationEvaluator) EvaluateSequentialNew(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation) (opOut *rlwe.Ciphertext, err error)
- type LinearTransformationParameters
- type Parameters
- type ParametersLiteral
- type Polynomial
- type PolynomialEvaluator
- type PolynomialVector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeLinearTransformation ¶
func EncodeLinearTransformation[T Integer](ecd *Encoder, diagonals Diagonals[T], allocated LinearTransformation) (err error)
EncodeLinearTransformation is a method used to encode EncodeLinearTransformation and a wrapper of he.EncodeLinearTransformation. See he.EncodeLinearTransformation for the documentation.
func GaloisElementsForLinearTransformation ¶
func GaloisElementsForLinearTransformation(params rlwe.ParameterProvider, lt LinearTransformationParameters) (galEls []uint64)
GaloisElementsForLinearTransformation returns the list of Galois elements required to evaluate the linear transformation.
func NewCiphertext ¶
func NewCiphertext(params Parameters, degree, level int) *rlwe.Ciphertext
func NewDecryptor ¶
func NewDecryptor(params Parameters, key *rlwe.SecretKey) *rlwe.Decryptor
func NewEncryptor ¶
func NewEncryptor(params Parameters, key rlwe.EncryptionKey) *rlwe.Encryptor
func NewKeyGenerator ¶
func NewKeyGenerator(params Parameters) *rlwe.KeyGenerator
func NewPlaintext ¶
func NewPlaintext(params Parameters, level int) *rlwe.Plaintext
func NewPowerBasis ¶
func NewPowerBasis(ct *rlwe.Ciphertext) he.PowerBasis
NewPowerBasis is a wrapper of NewPolynomialBasis. This function creates a new powerBasis from the input ciphertext. The input ciphertext is treated as the base monomial X used to generate the other powers X^{n}.
Types ¶
type CoefficientGetter ¶
type CoefficientGetter struct {
Values []uint64
}
CoefficientGetter is a struct that implements the he.CoefficientGetter[uint64] interface.
func (CoefficientGetter) GetSingleCoefficient ¶
func (c CoefficientGetter) GetSingleCoefficient(pol he.Polynomial, k int) (value uint64)
GetSingleCoefficient should return the k-th coefficient of Polynomial as the type uint64.
func (CoefficientGetter) GetVectorCoefficient ¶
func (c CoefficientGetter) GetVectorCoefficient(pol he.PolynomialVector, k int) (values []uint64)
GetVectorCoefficient return a slice []uint64 containing the k-th coefficient of each polynomial of PolynomialVector indexed by its Mapping. See PolynomialVector for additional information about the Mapping.
func (CoefficientGetter) ShallowCopy ¶
func (c CoefficientGetter) ShallowCopy() he.CoefficientGetter[uint64]
ShallowCopy returns a thread-safe copy of the original CoefficientGetter.
type Diagonals ¶
Diagonals is a wrapper of he.Diagonals. See he.Diagonals for the documentation.
func (Diagonals[T]) DiagonalsIndexList ¶
DiagonalsIndexList returns the list of the non-zero diagonals of the square matrix. A non zero diagonals is a diagonal with a least one non-zero element.
type Encoder ¶
func NewEncoder ¶
func NewEncoder(params Parameters) *Encoder
func (Encoder) ShallowCopy ¶
type Evaluator ¶
func NewEvaluator ¶
func NewEvaluator(params Parameters, evk rlwe.EvaluationKeySet) *Evaluator
func (Evaluator) GetParameters ¶
func (eval Evaluator) GetParameters() *Parameters
func (Evaluator) ShallowCopy ¶
type LinearTransformation ¶
type LinearTransformation he.LinearTransformation
LinearTransformation is a wrapper of he.LinearTransformation. See he.LinearTransformation for the documentation.
func NewLinearTransformation ¶
func NewLinearTransformation(params rlwe.ParameterProvider, lt LinearTransformationParameters) LinearTransformation
NewLinearTransformation instantiates a new LinearTransformation and is a wrapper of he.LinearTransformation. See he.LinearTransformation for the documentation.
func (LinearTransformation) GaloisElements ¶
func (lt LinearTransformation) GaloisElements(params rlwe.ParameterProvider) []uint64
GaloisElements returns the list of Galois elements required to evaluate the linear transformation.
type LinearTransformationEvaluator ¶
type LinearTransformationEvaluator struct { he.EvaluatorForLinearTransformation he.EvaluatorForDiagonalMatrix }
LinearTransformationEvaluator is a struct for evaluating linear transformations on rlwe.Ciphertexts. All fields of this struct are public, enabling custom instantiations.
func NewLinearTransformationEvaluator ¶
func NewLinearTransformationEvaluator(eval he.EvaluatorForLinearTransformation) (linTransEval *LinearTransformationEvaluator)
NewLinearTransformationEvaluator instantiates a new LinearTransformationEvaluator from a circuit.EvaluatorForLinearTransformation. The default heint.Evaluator is compliant to the circuit.EvaluatorForLinearTransformation interface.
func (LinearTransformationEvaluator) Evaluate ¶
func (eval LinearTransformationEvaluator) Evaluate(ctIn *rlwe.Ciphertext, linearTransformation LinearTransformation, opOut *rlwe.Ciphertext) (err error)
Evaluate takes as input a ciphertext ctIn, a linear transformation M and evaluates opOut: M(ctIn).
func (LinearTransformationEvaluator) EvaluateMany ¶
func (eval LinearTransformationEvaluator) EvaluateMany(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation, opOut []*rlwe.Ciphertext) (err error)
EvaluateMany takes as input a ciphertext ctIn, a list of linear transformations [M0, M1, M2, ...] and a list of pre-allocated receiver opOut and evaluates opOut: [M0(ctIn), M1(ctIn), M2(ctIn), ...]
func (LinearTransformationEvaluator) EvaluateManyNew ¶
func (eval LinearTransformationEvaluator) EvaluateManyNew(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation) (opOut []*rlwe.Ciphertext, err error)
EvaluateManyNew takes as input a ciphertext ctIn and a list of linear transformations [M0, M1, M2, ...] and returns opOut:[M0(ctIn), M1(ctIn), M2(ctInt), ...].
func (LinearTransformationEvaluator) EvaluateNew ¶
func (eval LinearTransformationEvaluator) EvaluateNew(ctIn *rlwe.Ciphertext, linearTransformation LinearTransformation) (opOut *rlwe.Ciphertext, err error)
EvaluateNew takes as input a ciphertext ctIn and a linear transformation M and evaluate and returns opOut: M(ctIn).
func (LinearTransformationEvaluator) EvaluateSequential ¶
func (eval LinearTransformationEvaluator) EvaluateSequential(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation, opOut *rlwe.Ciphertext) (err error)
EvaluateSequential takes as input a ciphertext ctIn and a list of linear transformations [M0, M1, M2, ...] and returns opOut:...M2(M1(M0(ctIn))
func (LinearTransformationEvaluator) EvaluateSequentialNew ¶
func (eval LinearTransformationEvaluator) EvaluateSequentialNew(ctIn *rlwe.Ciphertext, linearTransformations []LinearTransformation) (opOut *rlwe.Ciphertext, err error)
EvaluateSequentialNew takes as input a ciphertext ctIn and a list of linear transformations [M0, M1, M2, ...] and returns opOut:...M2(M1(M0(ctIn))
type LinearTransformationParameters ¶
type LinearTransformationParameters he.LinearTransformationParameters
LinearTransformationParameters is a wrapper of he.LinearTransformationParameters. See he.LinearTransformationParameters for the documentation.
type Parameters ¶
type Parameters struct {
bgv.Parameters
}
func NewParametersFromLiteral ¶
func NewParametersFromLiteral(paramsLit ParametersLiteral) (Parameters, error)
func (Parameters) Equal ¶
func (p Parameters) Equal(other *Parameters) bool
func (Parameters) MarshalBinary ¶
func (p Parameters) MarshalBinary() (d []byte, err error)
func (Parameters) MarshalJSON ¶
func (p Parameters) MarshalJSON() (d []byte, err error)
func (*Parameters) UnmarshalBinary ¶
func (p *Parameters) UnmarshalBinary(d []byte) (err error)
func (*Parameters) UnmarshalJSON ¶
func (p *Parameters) UnmarshalJSON(d []byte) (err error)
type ParametersLiteral ¶
type ParametersLiteral bgv.ParametersLiteral
type Polynomial ¶
type Polynomial he.Polynomial
Polynomial is a type wrapping the type he.Polynomial.
func NewPolynomial ¶
func NewPolynomial[T Integer](coeffs []T) Polynomial
NewPolynomial creates a new Polynomial from a list of coefficients []T.
type PolynomialEvaluator ¶
type PolynomialEvaluator struct { he.EvaluatorForPolynomial Parameters InvariantTensoring bool }
PolynomialEvaluator is a wrapper of the he.PolynomialEvaluator. All fields of this struct are public, enabling custom instantiations.
func NewPolynomialEvaluator ¶
func NewPolynomialEvaluator(params Parameters, eval he.Evaluator, InvariantTensoring bool) *PolynomialEvaluator
NewPolynomialEvaluator instantiates a new PolynomialEvaluator from a circuit.Evaluator. The default heint.Evaluator is compliant to the circuit.Evaluator interface. InvariantTensoring is a boolean that specifies if the evaluator performed the invariant tensoring (BFV-style) or the regular tensoring (BGB-style).
func (PolynomialEvaluator) Evaluate ¶
func (eval PolynomialEvaluator) Evaluate(ct *rlwe.Ciphertext, p interface{}, targetScale rlwe.Scale) (opOut *rlwe.Ciphertext, err error)
Evaluate evaluates a polynomial on the input Ciphertext in ceil(log2(deg+1)) levels. Returns an error if the input ciphertext does not have enough level to carry out the full polynomial evaluation. Returns an error if something is wrong with the scale. If the polynomial is given in Chebyshev basis, then a change of basis ct' = (2/(b-a)) * (ct + (-a-b)/(b-a)) is necessary before the polynomial evaluation to ensure correctness. pol: a *bignum.Polynomial, *Polynomial or *PolynomialVector targetScale: the desired output scale. This value shouldn't differ too much from the original ciphertext scale. It can for example be used to correct small deviations in the ciphertext scale and reset it to the default scale.
func (PolynomialEvaluator) EvaluateFromPowerBasis ¶
func (eval PolynomialEvaluator) EvaluateFromPowerBasis(pb he.PowerBasis, p interface{}, targetScale rlwe.Scale) (opOut *rlwe.Ciphertext, err error)
EvaluateFromPowerBasis evaluates a polynomial using the provided PowerBasis, holding pre-computed powers of X. This method is the same as Evaluate except that the encrypted input is a PowerBasis. See Evaluate for additional information.
type PolynomialVector ¶
type PolynomialVector he.PolynomialVector
PolynomialVector is a type wrapping the type he.PolynomialVector.
func NewPolynomialVector ¶
func NewPolynomialVector[T Integer](polys [][]T, mapping map[int][]int) (PolynomialVector, error)
func (PolynomialVector) Depth ¶
func (p PolynomialVector) Depth() int
Depth returns the depth of the target PolynomialVector.