CryptoContext
- class openfhe.CryptoContext
- Bases: - pybind11_object- static ClearEvalAutomorphismKeys() None
- Flush EvalAutomorphismKey cache 
 - Compress(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, towersLeft: SupportsInt) openfhe.openfhe.Ciphertext
 - Decrypt(*args, **kwargs)
- Overloaded function. - Decrypt(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Plaintext 
 - Decrypt a single ciphertext into the appropriate plaintext - Parameters:
- ciphertext (Ciphertext) – ciphertext to decrypt 
- privateKey (PrivateKey) – decryption key 
 
- Returns:
- decrypted plaintext 
- Return type:
 - Decrypt(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, privateKey: openfhe.openfhe.PrivateKey) -> openfhe.openfhe.Plaintext 
 - Decrypt a single ciphertext into the appropriate plaintext - Parameters:
- ciphertext (Ciphertext) – ciphertext to decrypt 
- privateKey (PrivateKey) – decryption key 
 
- Returns:
- decrypted plaintext 
- Return type:
 
 - static DeserializeEvalAutomorphismKey(*args, **kwargs)
- Overloaded function. - DeserializeEvalAutomorphismKey(filename: str, sertype: openfhe.openfhe.SERBINARY) -> bool - DeserializeEvalAutomorphismKey deserialize all keys in the serialization deserialized keys silently replace any existing matching keys deserialization will create CryptoContext if necessary - param filename:
- path for the file to deserialize from 
- type filename:
- str 
- param sertype:
- type of serialization 
- type sertype:
- SERJSON, SERBINARY 
- return:
- bool: true on success 
 
- DeserializeEvalAutomorphismKey(filename: str, sertype: openfhe.openfhe.SERJSON) -> bool - DeserializeEvalAutomorphismKey deserialize all keys in the serialization deserialized keys silently replace any existing matching keys deserialization will create CryptoContext if necessary - param filename:
- path for the file to deserialize from 
- type filename:
- str 
- param sertype:
- type of serialization 
- type sertype:
- SERJSON, SERBINARY 
- return:
- bool: true on success 
 
 
 - static DeserializeEvalMultKey(*args, **kwargs)
- Overloaded function. - DeserializeEvalMultKey(filename: str, sertype: openfhe.openfhe.SERBINARY) -> bool - DeserializeEvalMultKey deserialize all keys in the serialization deserialized keys silently replace any existing matching keys deserialization will create CryptoContext if necessary - param filename:
- path for the file to deserialize from 
- type filename:
- str 
- param sertype:
- type of serialization 
- type sertype:
- SERJSON, SERBINARY 
- return:
- bool: true on success 
 
- DeserializeEvalMultKey(filename: str, sertype: openfhe.openfhe.SERJSON) -> bool - DeserializeEvalMultKey deserialize all keys in the serialization deserialized keys silently replace any existing matching keys deserialization will create CryptoContext if necessary - param filename:
- path for the file to deserialize from 
- type filename:
- str 
- param sertype:
- type of serialization 
- type sertype:
- SERJSON, SERBINARY 
- return:
- bool: true on success 
 
 
 - Enable(self: openfhe.openfhe.CryptoContext, feature: openfhe.openfhe.PKESchemeFeature) None
- Enable a particular feature for use with this CryptoContext - Parameters:
- feature (PKESchemeFeature) – the feature that should be enabled. The list of available features is defined in the PKESchemeFeature enum. 
 
 - Encrypt(self: openfhe.openfhe.CryptoContext, publicKey: openfhe.openfhe.PublicKey, plaintext: openfhe.openfhe.Plaintext) openfhe.openfhe.Ciphertext
- Encrypt a plaintext using a given public key - Parameters:
- Returns:
- ciphertext (or null on failure) 
- Return type:
 
 - EvalAdd(*args, **kwargs)
- Overloaded function. - EvalAdd(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 - Homomorphic addition of two ciphertexts - Parameters:
- ciphertext1 (Ciphertext) – first addend 
- ciphertext2 (Ciphertext) – second addend 
 
- Returns:
- the result as a new ciphertext 
- Return type:
 - EvalAdd(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, scalar: typing.SupportsFloat) -> openfhe.openfhe.Ciphertext 
 - EvalAdd - OpenFHE EvalAdd method for a ciphertext and a real number. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- constant (float) – a real number 
 
- Returns:
- new ciphertext for ciphertext + constant 
- Return type:
 - EvalAdd(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> openfhe.openfhe.Ciphertext 
 - EvalAdd - OpenFHE EvalAdd method for a ciphertext and plaintext - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- plaintex – input plaintext 
 
- Returns:
- new ciphertext for ciphertext + constant 
- Return type:
 
 - EvalAddInPlace(*args, **kwargs)
- Overloaded function. - EvalAddInPlace(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> None 
 - In-place homomorphic addition of two ciphertexts - Parameters:
- ciphertext1 (Ciphertext) – ciphertext1 
- ciphertext2 (Ciphertext) – second addend 
 
- Returns:
- ciphertext1 contains ciphertext1 + ciphertext2 
 - EvalAddInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> None 
 - In-place addition for a ciphertext and plaintext - Parameters:
- ciphertext (Ciphertext) – Input/output ciphertext 
- plaintext (Plaintext) – Input plaintext 
 
- Returns:
- ciphertext contains ciphertext + plaintext 
 - EvalAddInPlace(self: openfhe.openfhe.CryptoContext, plaintext: openfhe.openfhe.Plaintext, ciphertext: openfhe.openfhe.Ciphertext) -> None 
 
 - EvalAddMany(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext]) openfhe.openfhe.Ciphertext
 - EvalAddManyInPlace(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext]) openfhe.openfhe.Ciphertext
 - EvalAddMutable(*args, **kwargs)
- Overloaded function. - EvalAddMutable(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 - Homomorphic addition of two mutable ciphertexts (they can be changed during the operation) - Parameters:
- ciphertext1 (Ciphertext) – first addend 
- ciphertext2 (Ciphertext) – second addend 
 
- Returns:
- the result as a new ciphertext 
- Return type:
 - EvalAddMutable(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> openfhe.openfhe.Ciphertext 
 - Homomorphic addition a mutable ciphertext and plaintext - Parameters:
- ciphertext (Ciphertext) – ciphertext 
- plaintext (Plaintext) – plaintext 
 
- Returns:
- new ciphertext for ciphertext + plaintext 
- Return type:
 - EvalAddMutable(self: openfhe.openfhe.CryptoContext, plaintext: openfhe.openfhe.Plaintext, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 
 - EvalAddMutableInPlace(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) None
- Homomorphic addition a mutable ciphertext and plaintext - Parameters:
- ciphertext1 (Ciphertext) – first addend 
- ciphertext2 (Ciphertext) – second addend 
 
- Returns:
- ciphertext1 contains ciphertext1 + ciphertext2 
 
 - EvalAtIndex(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, index: SupportsInt) openfhe.openfhe.Ciphertext
- Rotates a ciphertext by an index (positive index is a left shift, negative index is a right shift). Uses a rotation key stored in a crypto context. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- i (int) – rotation index 
 
- Returns:
- a rotated ciphertext 
- Return type:
 
 - EvalAtIndexKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, indexList: collections.abc.Sequence[SupportsInt], publicKey: openfhe.openfhe.PublicKey = None) None
- EvalAtIndexKeyGen generates evaluation keys for a list of rotation indices - Parameters:
- privateKey (PrivateKey) – the private key 
- indexList (list) – list of indices 
- publicKey (PublicKey) – the public key (used in NTRU schemes). Not used anymore. 
 
- Returns:
- None 
 
 - EvalAutomorphismKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, indexList: collections.abc.Sequence[SupportsInt]) openfhe.openfhe.EvalKeyMap
- Generate automophism keys for a given private key; Uses the private key for encryption - Parameters:
- privateKey (PrivateKey) – private key. 
- indexList (list) – list of automorphism indices to be computed. 
 
- Returns:
- returns the evaluation key 
- Return type:
- EvalKeyMap 
 
 - EvalBootstrap(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, numIterations: SupportsInt = 1, precision: SupportsInt = 0) openfhe.openfhe.Ciphertext
- Defines the bootstrapping evaluation of ciphertext using either the FFT-like method or the linear method - Parameters:
- ciphertext (Ciphertext) – the input ciphertext 
- numIterations (int) – number of iterations to run iterative bootstrapping (Meta-BTS). Increasing the iterations increases the precision of bootstrapping 
- precision (int) – precision of initial bootstrapping algorithm. This value is determined by the user experimentally by first running EvalBootstrap with numIterations = 1 and precision = 0 (unused). 
 
- Returns:
- Ciphertext: the refreshed ciphertext 
- Return type:
 
 - EvalBootstrapKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, slots: SupportsInt) None
- Generates all automorphism keys for EvalBootstrap. Supported in CKKS only. EvalBootstrapKeyGen uses the baby-step/giant-step strategy. - Parameters:
- privateKey (PrivateKey) – private key. 
- slots (int) – number of slots to support permutations on. 
 
- Returns:
- None 
 
 - EvalBootstrapSetup(self: openfhe.openfhe.CryptoContext, levelBudget: collections.abc.Sequence[SupportsInt] = [5, 4], dim1: collections.abc.Sequence[SupportsInt] = [0, 0], slots: SupportsInt = 0, correctionFactor: SupportsInt = 0, precompute: bool = True) None
- Bootstrap functionality: There are three methods that have to be called in this specific order: - EvalBootstrapSetup: computes and encodes the coefficients for encoding and decoding and stores the necessary parameters 
- EvalBootstrapKeyGen: computes and stores the keys for rotations and conjugation 
- EvalBootstrap: refreshes the given ciphertext Sets all parameters for both linear and FTT-like methods. Supported in CKKS only. 
 - Parameters:
- levelBudget (list) – vector of budgets for the amount of levels in encoding and decoding 
- dim1 (list) – vector of inner dimension in the baby-step giant-step routine for encoding and decodingl 
- slots (int) – number of slots to be bootstraped 
- correctionFactor (int) – value to internally rescale message by to improve precision of bootstrapping. If set to 0, we use the default logic. This value is only used when NATIVE_SIZE=64. 
 
- Returns:
- None 
 
 - EvalCKKStoFHEW(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, numCtxts: SupportsInt = 0) list[openfhe.openfhe.LWECiphertext]
- Switches a CKKS ciphertext to a vector of FHEW ciphertexts. - Parameters:
- ciphertext (Ciphertext) – Input CKKS ciphertext. 
- numCtxts (int) – Number of coefficients to extract (defaults to number of slots if 0). 
 
 
 - EvalCKKStoFHEWKeyGen(self: openfhe.openfhe.CryptoContext, keyPair: openfhe.openfhe.KeyPair, lwesk: openfhe.openfhe.LWEPrivateKey) None
- Sets all parameters for switching from CKKS to FHEW. - Parameters:
- keyPair (KeyPair) – CKKS key pair. 
- lwesk (LWEPrivateKey) – FHEW secret key. 
 
 
 - EvalCKKStoFHEWPrecompute(self: openfhe.openfhe.CryptoContext, scale: SupportsFloat = 1.0) None
- Performs precomputations for CKKS homomorphic decoding. Allows setting a custom scale factor. Given as a separate method than EvalCKKStoFHEWSetup to allow the user to specify a scale that depends on the CKKS and FHEW cryptocontexts - Parameters:
- scale (float) – Scaling factor for the linear transform matrix. 
 
 - EvalCKKStoFHEWSetup(self: openfhe.openfhe.CryptoContext, schswchparams: lbcrypto::SchSwchParams) openfhe.openfhe.LWEPrivateKey
- Sets all parameters for switching from CKKS to FHEW. - Parameters:
- schswchparams (SchSwchParams) – Parameters for CKKS-to-FHEW scheme switching. 
- Returns:
- FHEW secret key. 
- Return type:
 
 - EvalChebyshevFunction(self: openfhe.openfhe.CryptoContext, func: collections.abc.Callable[[SupportsFloat], float], ciphertext: openfhe.openfhe.Ciphertext, a: SupportsFloat, b: SupportsFloat, degree: SupportsInt) openfhe.openfhe.Ciphertext
- Method for calculating Chebyshev evaluation on a ciphertext for a smooth input function over the range [a,b]. Supported only in CKKS. - Parameters:
- func (function) – the function to be approximated 
- ciphertext (Ciphertext) – input ciphertext 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
- degree (int) – Desired degree of approximation 
 
- Returns:
- the coefficients of the Chebyshev approximation. 
- Return type:
 
 - EvalChebyshevSeries(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, coefficients: collections.abc.Sequence[SupportsFloat], a: SupportsFloat, b: SupportsFloat) openfhe.openfhe.Ciphertext
- Method for evaluating Chebyshev polynomial interpolation; first the range [a,b] is mapped to [-1,1] using linear transformation 1 + 2 (x-a)/(b-a) If the degree of the polynomial is less than 5, use EvalChebyshevSeriesLinear (naive linear method), otherwise, use EvalChebyshevSeriesPS (Paterson-Stockmeyer method). Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- coefficients (list) – is the vector of coefficients in Chebyshev expansion 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
 
- Returns:
- the result of polynomial evaluation 
- Return type:
 
 - EvalChebyshevSeriesLinear(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, coefficients: collections.abc.Sequence[SupportsFloat], a: SupportsFloat, b: SupportsFloat) openfhe.openfhe.Ciphertext
- Naive linear method for evaluating Chebyshev polynomial interpolation; first the range [a,b] is mapped to [-1,1] using linear transformation 1 + 2 (x-a)/(b-a). Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- coefficients (list) – is the vector of coefficients in Chebyshev expansion 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
 
- Returns:
- the result of polynomial evaluation 
- Return type:
 
 - EvalChebyshevSeriesPS(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, coefficients: collections.abc.Sequence[SupportsFloat], a: SupportsFloat, b: SupportsFloat) openfhe.openfhe.Ciphertext
- Paterson-Stockmeyer method for evaluating Chebyshev polynomial interpolation; first the range [a,b] is mapped to [-1,1] using linear transformation 1 + 2 (x-a)/(b-a). Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- coefficients (list) – is the vector of coefficients in Chebyshev expansion 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
 
- Returns:
- the result of polynomial evaluation 
- Return type:
 
 - EvalCompareSchemeSwitching(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext, numCtxts: SupportsInt = 0, numSlots: SupportsInt = 0, pLWE: SupportsInt = 0, scaleSign: SupportsFloat = 1.0, unit: bool = False) openfhe.openfhe.Ciphertext
- Compares two CKKS ciphertexts using FHEW-based scheme switching and returns CKKS result. - Parameters:
- ciphertext1 (Ciphertext.) – First input CKKS ciphertext. 
- ciphertext2 (Ciphertext.) – Second input CKKS ciphertext. 
- numCtxts (int.) – Number of coefficients to extract. 
- numSlots (int.) – Number of slots to encode in the result. 
- pLWE (int.) – Target plaintext modulus for FHEW ciphertexts. 
- scaleSign (float.) – Scaling factor for CKKS ciphertexts before switching. 
- unit (bool.) – Indicates if input messages are normalized to unit circle. 
 
- Returns:
- CKKS ciphertext encoding sign comparison result. 
- Return type:
 
 - EvalCompareSwitchPrecompute(self: openfhe.openfhe.CryptoContext, pLWE: SupportsInt = 0, scaleSign: SupportsFloat = 1.0, unit: bool = False) None
- Performs precomputations for scheme switching in CKKS-to-FHEW comparison. Given as a separate method than EvalSchemeSwitchingSetup to allow the user to specify a scale. - Parameters:
- pLWE (int.) – Target plaintext modulus for FHEW ciphertexts. 
- scaleSign (float.) – Scaling factor for CKKS ciphertexts before switching. 
- unit (bool.) – Indicates if input messages are normalized to unit circle. 
 
 
 - EvalCos(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, a: SupportsFloat, b: SupportsFloat, degree: SupportsInt) openfhe.openfhe.Ciphertext
- Evaluate approximate cosine function on a ciphertext using the Chebyshev approximation. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
- degree (int) – Desired degree of approximation 
 
- Returns:
- the result of polynomial evaluation. 
- Return type:
 
 - EvalDivide(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, a: SupportsFloat, b: SupportsFloat, degree: SupportsInt) openfhe.openfhe.Ciphertext
- Evaluate approximate division function 1/x where x >= 1 on a ciphertext using the Chebyshev approximation. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
- degree (int) – Desired degree of approximation 
 
- Returns:
- the result of polynomial evaluation. 
- Return type:
 
 - EvalFHEWtoCKKS(self: openfhe.openfhe.CryptoContext, LWECiphertexts: collections.abc.Sequence[openfhe.openfhe.LWECiphertext], numCtxts: SupportsInt = 0, numSlots: SupportsInt = 0, p: SupportsInt = 4, pmin: SupportsFloat = 0.0, pmax: SupportsFloat = 2.0, dim1: SupportsInt = 0) openfhe.openfhe.Ciphertext
- Switches a vector of FHEW ciphertexts to a single CKKS ciphertext. - Parameters:
- LWECiphertexts (list of LWECiphertext.) – Input vector of FHEW ciphertexts. 
- numCtxts (int) – Number of values to encode. 
- numSlots (int) – Number of CKKS slots to use. 
- p (int.) – Plaintext modulus (default = 4). 
- pmin (float.) – Minimum expected plaintext value (default = 0.0). 
- pmax (float.) – Maximum expected plaintext value (default = 2.0). 
- dim1 (int.) – Baby-step parameter (used in argmin). 
 
- Returns:
- CKKS ciphertext encoding the input LWE messages. 
- Return type:
 
 - EvalFHEWtoCKKSKeyGen(self: openfhe.openfhe.CryptoContext, keyPair: openfhe.openfhe.KeyPair, lwesk: openfhe.openfhe.LWEPrivateKey, numSlots: SupportsInt = 0, numCtxts: SupportsInt = 0, dim1: SupportsInt = 0, L: SupportsInt = 0) None
- Generates keys for switching from FHEW to CKKS. - Parameters:
- keyPair (KeyPair) – CKKS key pair. 
- lwesk (LWEPrivateKey) – FHEW secret key. 
- numSlots (int) – Number of slots for CKKS encryption. 
- numCtxts (int) – Number of LWE ciphertext values to encrypt. 
- dim1 (int) – Baby-step parameter for linear transform. 
- L (int) – Target level for homomorphic decoding matrix. 
 
 
 - EvalFHEWtoCKKSSetup(self: openfhe.openfhe.CryptoContext, ccLWE: openfhe.openfhe.BinFHEContext, numSlotsCKKS: SupportsInt = 0, logQ: SupportsInt = 25) None
- Sets parameters for switching from FHEW to CKKS. Requires existing CKKS context. - Parameters:
- ccLWE (BinFHEContext) – Source FHEW crypto context. 
 - :param numSlotsCKKS Number of slots in resulting CKKS ciphertext. :type numSlotsCKKS: int :param logQ: Ciphertext modulus size in FHEW (for high precision). :type logQ: int 
 - EvalFastRotation(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, index: SupportsInt, m: SupportsInt, digits: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- EvalFastRotation implements the automorphism and key switching step of hoisted automorphisms. - Please refer to Section 5 of Halevi and Shoup, “Faster Homomorphic linear transformations in HELib.” for more details, link: https://eprint.iacr.org/2018/244. - Generally, automorphisms are performed with three steps: (1) The automorphism is applied to the ciphertext. (2) The automorphed values are decomposed into digits. (3) Key switching is applied to enable further computations on the ciphertext. - Hoisted automorphisms are a technique that performs the digit decomposition for the original ciphertext first, and then performs the automorphism and the key switching on the decomposed digits. The benefit of this is that the digit decomposition is independent of the automorphism rotation index, so it can be reused for multiple different indices. This can greatly improve performance when we have to compute many automorphisms on the same ciphertext. This routinely happens when we do permutations (EvalPermute). - EvalFastRotation implements the automorphism and key switching step of hoisted automorphisms. - This method assumes that all required rotation keys exist. This may not be true if we are using baby-step/giant-step key switching. Please refer to Section 5.1 of the above reference and EvalPermuteBGStepHoisted to see how to deal with this issue. - Parameters:
- ciphertext (Ciphertext) – the input ciphertext to perform the automorphism on 
- index (int) – the index of the rotation. Positive indices correspond to left rotations and negative indices correspond to right rotations. 
- m (int) – is the cyclotomic order 
- digits (Ciphertext) – the precomputed ciphertext created by EvalFastRotationPrecompute using the digit decomposition at the precomputation step 
 
- Returns:
- the rotated ciphertext 
- Return type:
 
 - EvalFastRotationExt(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, index: SupportsInt, digits: openfhe.openfhe.Ciphertext, addFirst: bool) openfhe.openfhe.Ciphertext
- Only supported for hybrid key switching. Performs fast (hoisted) rotation and returns the results in the extended CRT basis P*Q - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- index (int) – the rotation index 
- digits (Ciphertext) – the precomputed ciphertext created by EvalFastRotationPrecompute 
- addFirst (bool) – if true, the first element c0 is also computed (otherwise ignored) 
 
- Returns:
- resulting ciphertext 
- Return type:
 
 - EvalFastRotationPrecompute(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- EvalFastRotationPrecompute implements the precomputation step of hoisted automorphisms. - Please refer to Section 5 of Halevi and Shoup, “Faster Homomorphic linear transformations in HELib.” for more details, link: https://eprint.iacr.org/2018/244. - Generally, automorphisms are performed with three steps: (1) The automorphism is applied to the ciphertext. (2) The automorphed values are decomposed into digits. (3) Key switching is applied to enable further computations on the ciphertext. - Hoisted automorphisms are a technique that performs the digit decomposition for the original ciphertext first, and then performs the automorphism and the key switching on the decomposed digits. The benefit of this is that the digit decomposition is independent of the automorphism rotation index, so it can be reused for multiple different indices. This can greatly improve performance when we have to compute many automorphisms on the same ciphertext. This routinely happens when we do permutations (EvalPermute). - EvalFastRotationPrecompute implements the digit decomposition step of hoisted automorphisms. - Parameters:
- ciphertext (Ciphertext) – the input ciphertext on which to do the precomputation (digit decomposition) 
- Returns:
- the precomputed ciphertext created using the digit decomposition 
- Return type:
 
 - EvalInnerProduct(*args, **kwargs)
- Overloaded function. - EvalInnerProduct(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext, batchSize: typing.SupportsInt) -> openfhe.openfhe.Ciphertext - Evaluates inner product in packed encoding (uses EvalSum) - param ciphertext1:
- first vector 
- type ciphertext1:
- Ciphertext 
- param ciphertext2:
- second vector 
- type ciphertext2:
- Ciphertext 
- param batchSize:
- size of the batch to be summed up 
- type batchSize:
- int 
- return:
- Ciphertext: resulting ciphertext 
- rtype:
- Ciphertext 
 
- EvalInnerProduct(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext, batchSize: typing.SupportsInt) -> openfhe.openfhe.Ciphertext - Evaluates inner product in packed encoding (uses EvalSum) - param ciphertext:
- first vector - ciphertext 
- type ciphertext:
- Ciphertext 
- param plaintext:
- second vector - plaintext 
- type plaintext:
- Plaintext 
- param batchSize:
- size of the batch to be summed up 
- type batchSize:
- int 
- return:
- Ciphertext: resulting ciphertext 
- rtype:
- Ciphertext 
 
 
 - EvalLinearWSum(self: openfhe.openfhe.CryptoContext, ciphertext: collections.abc.Sequence[openfhe.openfhe.Ciphertext], coefficients: collections.abc.Sequence[SupportsFloat]) openfhe.openfhe.Ciphertext
 - EvalLinearWSumMutable(self: openfhe.openfhe.CryptoContext, ciphertext: collections.abc.Sequence[SupportsFloat], coefficients: collections.abc.Sequence[openfhe.openfhe.Ciphertext]) openfhe.openfhe.Ciphertext
 - EvalLogistic(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, a: SupportsFloat, b: SupportsFloat, degree: SupportsInt) openfhe.openfhe.Ciphertext
- Evaluate approximate logistic function 1/(1 + exp(-x)) on a ciphertext using the Chebyshev approximation. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
- degree (int) – Desired degree of approximation 
 
- Returns:
- the result of polynomial evaluation. 
- Return type:
 
 - EvalMaxSchemeSwitching(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, publicKey: openfhe.openfhe.PublicKey, numValues: SupportsInt = 0, numSlots: SupportsInt = 0, pLWE: SupportsInt = 0, scaleSign: SupportsFloat = 1.0) list[openfhe.openfhe.Ciphertext]
- Computes maximum and index from the first packed values using scheme switching. - Parameters:
- ciphertext (Ciphertext.) – Input CKKS ciphertext. 
- publicKey (PublicKey.) – CKKS public key. 
- numValues (int.) – Number of values to compare (we assume that numValues is a power of two). 
- numSlots (int.) – Number of output slots. 
- pLWE (int.) – Target plaintext modulus for FHEW. 
- scaleSign (float.) – Scaling factor before switching to FHEW. 
 
- Returns:
- A vector of two CKKS ciphertexts: [max, argmax]. The ciphertexts have junk after the first slot in the first ciphertext and after numValues in the second ciphertext if oneHot=true and after the first slot if oneHot=false. 
- Return type:
- list of Ciphertext. 
 
 - EvalMaxSchemeSwitchingAlt(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, publicKey: openfhe.openfhe.PublicKey, numValues: SupportsInt = 0, numSlots: SupportsInt = 0, pLWE: SupportsInt = 0, scaleSign: SupportsFloat = 1.0) list[openfhe.openfhe.Ciphertext]
- Computes max and index via scheme switching, with more FHEW operations for better precision than EvalMaxSchemeSwitching. - Parameters:
- ciphertext (Ciphertext.) – Input CKKS ciphertext. 
- publicKey (PublicKey.) – CKKS public key. 
- numValues (int.) – Number of values to compare. 
- numSlots (int.) – Number of output slots. 
- pLWE (int.) – Target plaintext modulus for FHEW. 
- scaleSign (float.) – Scaling factor before switching to FHEW. 
 
- Returns:
- A vector of two CKKS ciphertexts: [max, argmax]. 
- Return type:
- list of Ciphertext. 
 
 - EvalMerge(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext]) openfhe.openfhe.Ciphertext
- Merges multiple ciphertexts with encrypted results in slot 0 into a single ciphertext. The slot assignment is done based on the order of ciphertexts in the vector. Requires the generation of rotation keys for the indices that are needed. - Parameters:
- ciphertextVec (list) – vector of ciphertexts to be merged. 
- Returns:
- resulting ciphertext 
- Return type:
 
 - EvalMinSchemeSwitching(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, publicKey: openfhe.openfhe.PublicKey, numValues: SupportsInt = 0, numSlots: SupportsInt = 0, pLWE: SupportsInt = 0, scaleSign: SupportsFloat = 1.0) list[openfhe.openfhe.Ciphertext]
- Computes minimum and index of the first packed values using scheme switching. - Parameters:
- ciphertext (Ciphertext.) – Input CKKS ciphertext. 
- publicKey (PublicKey.) – CKKS public key. 
- numValues (int.) – Number of values to compare (we assume that numValues is a power of two). 
- numSlots (int.) – Number of output slots. 
- pLWE (int.) – Target plaintext modulus for FHEW. 
- scaleSign (float.) – Scaling factor before switching to FHEW. The resulting FHEW ciphertexts will encrypt values modulo pLWE, so scaleSign should account for this pLWE and is given here only if the homomorphic decoding matrix is not scaled with the desired values 
 
- Returns:
- A vector of two CKKS ciphertexts: [min, argmin]. The ciphertexts have junk after the first slot in the first ciphertext and after numValues in the second ciphertext if oneHot=true and after the first slot if oneHot=false. 
- Return type:
- list of Ciphertext. 
 
 - EvalMinSchemeSwitchingAlt(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, publicKey: openfhe.openfhe.PublicKey, numValues: SupportsInt = 0, numSlots: SupportsInt = 0, pLWE: SupportsInt = 0, scaleSign: SupportsFloat = 1.0) list[openfhe.openfhe.Ciphertext]
- Computes minimum and index using more FHEW operations than CKKS with higher precision, but slower than EvalMinSchemeSwitching. - Parameters:
- ciphertext (Ciphertext.) – Input CKKS ciphertext. 
- publicKey (PublicKey.) – CKKS public key. 
- numValues (int.) – Number of packed values to compare. 
- numSlots (int.) – Number of slots in the output ciphertexts. 
- pLWE (int.) – Target plaintext modulus for FHEW ciphertexts. 
- scaleSign (float.) – Scaling factor before switching to FHEW. 
 
- Returns:
- A vector with two CKKS ciphertexts: [min, argmin]. 
- Return type:
- list of Ciphertext. 
 
 - EvalMult(*args, **kwargs)
- Overloaded function. - EvalMult(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 - EvalMult - OpenFHE EvalMult method for a pair of ciphertexts (uses a relinearization key from the crypto context) - Parameters:
- ciphertext1 (Ciphertext) – multiplier 
- ciphertext2 (Ciphertext) – multiplicand 
 
- Returns:
- new ciphertext for ciphertext1 * ciphertext2 
- Return type:
 - EvalMult(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, scalar: typing.SupportsFloat) -> openfhe.openfhe.Ciphertext 
 - Multiplication of a ciphertext by a real number. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – multiplier 
- constant (float) – multiplicand 
 
- Returns:
- the result of multiplication 
- Return type:
 - EvalMult(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> openfhe.openfhe.Ciphertext 
 - Multiplication of a ciphertext by a plaintext - Parameters:
- ciphertext (Ciphertext) – multiplier 
- plaintext (Plaintext) – multiplicand 
 
- Returns:
- the result of multiplication 
- Return type:
 - EvalMult(self: openfhe.openfhe.CryptoContext, plaintext: openfhe.openfhe.Plaintext, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
- EvalMult(self: openfhe.openfhe.CryptoContext, scalar: typing.SupportsFloat, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 
 - EvalMultAndRelinearize(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Homomorphic multiplication of two ciphertexts followed by relinearization to the lowest level - Parameters:
- ciphertext1 (Ciphertext) – first input ciphertext 
- ciphertext2 (Ciphertext) – second input ciphertext 
 
- Returns:
- new ciphertext 
- Return type:
 
 - EvalMultKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey) None
- EvalMultKeyGen creates a key that can be used with the OpenFHE EvalMult operator. The new evaluation key is stored in cryptocontext. - Parameters:
- privateKey (PrivateKey) – the private key 
 
 - EvalMultKeysGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey) None
- EvalMultsKeyGen creates a vector evalmult keys that can be used with the OpenFHE EvalMult operator. The 1st key (for s^2) is used for multiplication of ciphertexts of depth 1. The 2nd key (for s^3) is used for multiplication of ciphertexts of depth 2, etc. A vector of new evaluation keys is stored in cryptocontext. - Parameters:
- privateKey (PrivateKey) – the private key 
 
 - EvalMultMany(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext]) openfhe.openfhe.Ciphertext
 - EvalMultMutable(*args, **kwargs)
- Overloaded function. - EvalMultMutable(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 - EvalMult - OpenFHE EvalMult method for a pair of mutable ciphertexts (uses a relinearization key from the crypto context) - Parameters:
- ciphertext1 (Ciphertext) – multiplier 
- ciphertext2 (Ciphertext) – multiplicand 
 
- Returns:
- new ciphertext for ciphertext1 * ciphertext2 
- Return type:
 - EvalMultMutable(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> openfhe.openfhe.Ciphertext 
 - Multiplication of mutable ciphertext and plaintext :param ciphertext: multiplier :type ciphertext: Ciphertext :param plaintext: multiplicand :type plaintext: Plaintext :return: the result of multiplication :rtype: Ciphertext - EvalMultMutable(self: openfhe.openfhe.CryptoContext, plaintext: openfhe.openfhe.Plaintext, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 
 - EvalMultMutableInPlace(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) None
- In-place EvalMult method for a pair of mutable ciphertexts (uses a relinearization key from the crypto context) - Parameters:
- ciphertext1 (Ciphertext) – multiplier 
- ciphertext2 (Ciphertext) – multiplicand 
 
 
 - EvalMultNoRelin(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Homomorphic multiplication of two ciphertexts without relinearization - Parameters:
- ciphertext1 (Ciphertext) – multiplier 
- ciphertext2 (Ciphertext) – multiplicand 
 
- Returns:
- new ciphertext for ciphertext1 * ciphertext2 
- Return type:
 
 - EvalNegate(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Negates a ciphertext - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- Returns:
- new ciphertext: -ciphertext 
- Return type:
 
 - EvalNegateInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) None
- In-place negation of a ciphertext - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
 
 - EvalPoly(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, coefficients: collections.abc.Sequence[SupportsFloat]) openfhe.openfhe.Ciphertext
- Evaluates a polynomial (given as a power series) on a ciphertext (CKKS only). Use EvalPolyLinear() for low polynomial degrees (degree < 5), or EvalPolyPS() for higher degrees. - Parameters:
- ciphertext (Ciphertext) – Input ciphertext. 
- coefficients (list) – Polynomial coefficients (vector’s size = (degree + 1)). 
 
- Returns:
- Ciphertext: Resulting ciphertext. 
- Return type:
 
 - EvalPolyLinear(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, coefficients: collections.abc.Sequence[SupportsFloat]) openfhe.openfhe.Ciphertext
- Naive method for polynomial evaluation for polynomials represented in the power series (fast only for small-degree polynomials; less than 10). Uses a binary tree computation of the polynomial powers. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- coefficients (list) – is the vector of coefficients in the polynomial; the size of the vector is the degree of the polynomial 
 
- Returns:
- Ciphertext: the result of polynomial evaluation. 
- Return type:
 
 - EvalPolyPS(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, coefficients: collections.abc.Sequence[SupportsFloat]) openfhe.openfhe.Ciphertext
- Paterson-Stockmeyer method for evaluation for polynomials represented in the power series. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- coefficients (list) – is the vector of coefficients in the polynomial; the size of the vector is the degree of the polynomial 
 
- Returns:
- Ciphertext: the result of polynomial evaluation. 
- Return type:
 
 - EvalRotate(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, index: SupportsInt) openfhe.openfhe.Ciphertext
- Rotates a ciphertext by an index (positive index is a left shift, negative index is a right shift). Uses a rotation key stored in a crypto context. Calls EvalAtIndex under the hood. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- index (int) – rotation index 
 
- Returns:
- a rotated ciphertext 
- Return type:
 
 - EvalRotateKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, indexList: collections.abc.Sequence[SupportsInt], publicKey: openfhe.openfhe.PublicKey = None) None
- EvalRotateKeyGen generates evaluation keys for a list of indices. Calls EvalAtIndexKeyGen under the hood. - Parameters:
- privateKey (PrivateKey) – private key 
- indexList (list) – list of integers representing the indices 
- publicKey (PublicKey) – public key (used in NTRU schemes) 
 
 
 - EvalSchemeSwitchingKeyGen(self: openfhe.openfhe.CryptoContext, keyPair: openfhe.openfhe.KeyPair, lwesk: openfhe.openfhe.LWEPrivateKey) None
- Generates keys for switching between CKKS and FHEW. - Parameters:
- keyPair (KeyPair.) – CKKS key pair. 
- lwesk (LWEPrivateKey.) – FHEW secret key. 
 
 
 - EvalSchemeSwitchingSetup(self: openfhe.openfhe.CryptoContext, schswchparams: lbcrypto::SchSwchParams) openfhe.openfhe.LWEPrivateKey
- Sets parameters for switching between CKKS and FHEW. - Parameters:
- schswchparams (SchSwchParams.) – Scheme switching parameter object. 
- Returns:
- FHEW secret key. 
- Return type:
- LWEPrivateKey. 
 
 - EvalSin(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, a: SupportsFloat, b: SupportsFloat, degree: SupportsInt) openfhe.openfhe.Ciphertext
- Evaluate approximate sine function on a ciphertext using the Chebyshev approximation. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- a (float) – lower bound of argument for which the coefficients were found 
- b (float) – upper bound of argument for which the coefficients were found 
- degree (int) – Desired degree of approximation 
 
- Returns:
- the result of polynomial evaluation. 
- Return type:
 
 - EvalSquare(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Efficient homomorphic squaring of a ciphertext - uses a relinearization key stored in the crypto context - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- Returns:
- squared ciphertext 
- Return type:
 
 - EvalSquareInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) None
- In-place homomorphic squaring of a mutable ciphertext - uses a relinearization key stored in the crypto context - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- Returns:
- squared ciphertext 
 
 - EvalSquareMutable(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Efficient homomorphic squaring of a mutable ciphertext - uses a relinearization key stored in the crypto context - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- Returns:
- squared ciphertext 
- Return type:
 
 - EvalSub(*args, **kwargs)
- Overloaded function. - EvalSub(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 - Homomorphic subtraction of two ciphertexts - Parameters:
- ciphertext1 (Ciphertext) – minuend 
- ciphertext2 (Ciphertext) – subtrahend 
 
- Returns:
- the result as a new ciphertext 
- Return type:
 - EvalSub(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, scalar: typing.SupportsFloat) -> openfhe.openfhe.Ciphertext 
 - Subtraction of a ciphertext and a real number. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- constant (float) – a real number 
 
- Returns:
- new ciphertext for ciphertext - constant 
- Return type:
 - EvalSub(self: openfhe.openfhe.CryptoContext, scalar: typing.SupportsFloat, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
- EvalSub(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> openfhe.openfhe.Ciphertext 
 - Subtraction of a ciphertext and a real number. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – minuend 
- plaintext (Plaintext) – subtrahend 
 
- Returns:
- new ciphertext for ciphertext - plaintext 
- Return type:
 - EvalSub(self: openfhe.openfhe.CryptoContext, plaintext: openfhe.openfhe.Plaintext, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 
 - EvalSubInPlace(*args, **kwargs)
- Overloaded function. - EvalSubInPlace(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> None 
 - In-place homomorphic subtraction of two ciphertexts - Parameters:
- ciphertext1 (Ciphertext) – minuend 
- ciphertext2 (Ciphertext) – subtrahend 
 
- Returns:
- the result as a new ciphertext 
 - EvalSubInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, scalar: typing.SupportsFloat) -> None 
 - In-place subtraction of a ciphertext and a real number. Supported only in CKKS. - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- constant (float) – a real number 
 
 - EvalSubInPlace(self: openfhe.openfhe.CryptoContext, scalar: typing.SupportsFloat, ciphertext: openfhe.openfhe.Ciphertext) -> None 
 
 - EvalSubMutable(*args, **kwargs)
- Overloaded function. - EvalSubMutable(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 - Homomorphic subtraction of two mutable ciphertexts - Parameters:
- ciphertext1 (Ciphertext) – minuend 
- ciphertext2 (Ciphertext) – subtrahend 
 
- Returns:
- the result as a new ciphertext 
 - EvalSubMutable(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, plaintext: openfhe.openfhe.Plaintext) -> openfhe.openfhe.Ciphertext 
 - Homomorphic subtraction of mutable ciphertext and plaintext - Parameters:
- ciphertext (Ciphertext) – minuend 
- plaintext (Plaintext) – subtrahend 
 
- Returns:
- new ciphertext for ciphertext - plaintext 
 - EvalSubMutable(self: openfhe.openfhe.CryptoContext, plaintext: openfhe.openfhe.Plaintext, ciphertext: openfhe.openfhe.Ciphertext) -> openfhe.openfhe.Ciphertext 
 
 - EvalSubMutableInPlace(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) None
- In-place homomorphic subtraction of two mutable ciphertexts - Parameters:
- ciphertext1 (Ciphertext) – minuend 
- ciphertext2 (Ciphertext) – subtrahend 
 
- Returns:
- the updated minuend 
 
 - EvalSum(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, batchSize: SupportsInt) openfhe.openfhe.Ciphertext
- Function for evaluating a sum of all components in a vector. - Parameters:
- ciphertext (Ciphertext) – the input ciphertext 
- batchSize (int) – size of the batch 
 
- Returns:
- resulting ciphertext 
- Return type:
 
 - EvalSumCols(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, numCols: SupportsInt, evalSumKeyMap: openfhe.openfhe.EvalKeyMap) openfhe.openfhe.Ciphertext
- Sums all elements across each column in a packed-encoded matrix ciphertext. - Parameters:
- ciphertext (Ciphertext) – Input ciphertext. 
- numCols (int) – Number of columns in the matrix. 
- evalSumKeyMap (EvalKeyMap) – Map of evaluation keys generated for column summation. 
 
- Returns:
- Ciphertext: Ciphertext containing column-wise sums. 
- Return type:
 
 - EvalSumColsKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, publicKey: openfhe.openfhe.PublicKey = None) openfhe.openfhe.EvalKeyMap
- Generates automorphism keys for EvalSumCols (only for packed encoding). - Parameters:
- privateKey (PrivateKey) – Private key used for key generation. 
- publicKey (PublicKey) – Public key (used in NTRU schemes; unused now). 
 
- Returns:
- Map of generated evaluation keys. 
- Return type:
- EvalKeyMap 
 
 - EvalSumKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, publicKey: openfhe.openfhe.PublicKey = None) None
- EvalSumKeyGen Generates the key map to be used by EvalSum - Parameters:
- privateKey (PrivateKey) – private key 
- publicKey (PublicKey) – public key (used in NTRU schemes) 
 
- Returns:
- None 
 
 - EvalSumRows(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, numRows: SupportsInt, evalSumKeyMap: openfhe.openfhe.EvalKeyMap, subringDim: SupportsInt = 0) openfhe.openfhe.Ciphertext
- Sums all elements across each row in a packed-encoded matrix ciphertext. - Parameters:
- ciphertext (Ciphertext) – Input ciphertext. 
- numRows (int) – Number of rows in the matrix. 
- evalSumKeyMap (EvalKeyMap) – Map of evaluation keys generated for row summation. 
- subringDim (int) – Subring dimension (use full cyclotomic order if 0). 
 
- Returns:
- Ciphertext: Ciphertext containing row-wise sums. 
- Return type:
 
 - EvalSumRowsKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, publicKey: openfhe.openfhe.PublicKey = None, rowSize: SupportsInt = 0, subringDim: SupportsInt = 0) openfhe.openfhe.EvalKeyMap
- Generates automorphism keys for EvalSumRows (only for packed encoding). - Parameters:
- privateKey (PrivateKey) – Private key used for key generation. 
- publicKey (PublicKey) – Public key (used in NTRU schemes; unused now). 
- rowSize (int) – Number of slots per row in the packed matrix. 
- subringDim (int) – Subring dimension (use cyclotomic order if 0). 
 
- Returns:
- Map of generated evaluation keys. 
- Return type:
- EvalKeyMap 
 
 - FindAutomorphismIndex(self: openfhe.openfhe.CryptoContext, idx: SupportsInt) int
- Finds an automorphism index for a given vector index using a scheme-specific algorithm - Parameters:
- idx (int) – regular vector index 
- Returns:
- the automorphism index 
- Return type:
- int 
 
 - FindAutomorphismIndices(self: openfhe.openfhe.CryptoContext, idxList: collections.abc.Sequence[SupportsInt]) list[int]
- Finds automorphism indices for a given list of vector indices using a scheme-specific algorithm - Parameters:
- idxList (List[int]) – list of indices 
- Returns:
- a list of automorphism indices 
- Return type:
- List[int] 
 
 - GetBatchSize(self: openfhe.openfhe.CryptoContext) int
 - GetBinCCForSchemeSwitch(self: openfhe.openfhe.CryptoContext) openfhe.openfhe.BinFHEContext
 - GetCKKSDataType(self: openfhe.openfhe.CryptoContext) openfhe.openfhe.CKKSDataType
 - GetCompositeDegree(self: openfhe.openfhe.CryptoContext) int
 - GetCyclotomicOrder(self: openfhe.openfhe.CryptoContext) int
- Getter for cyclotomic order - Returns:
- cyclotomic order 
- Return type:
- int 
 
 - GetDigitSize(self: openfhe.openfhe.CryptoContext) int
 - GetEvalAddCount(self: openfhe.openfhe.CryptoContext) int
 - static GetEvalAutomorphismKeyMap(keyTag: str = '') openfhe.openfhe.EvalKeyMap
- Get automorphism keys for a specific secret key tag - Parameters:
- keyId (str) – key identifier used for private key 
- Returns:
- EvalKeyMap: map with all automorphism keys. 
- Return type:
- EvalKeyMap 
 
 - static GetEvalMultKeyVector(keyTag: str = '') list[openfhe.openfhe.EvalKey]
- Get relinearization keys for a specific secret key tag - Parameters:
- keyId (str) – key identifier used for private key 
- Returns:
- EvalKeyVector: vector with all relinearization keys. 
- Return type:
- EvalKeyVector 
 
 - GetEvalSumKeyMap(self: openfhe.openfhe.CryptoContext, arg0: str) openfhe.openfhe.EvalKeyMap
- Get a map of summation keys (each is composed of several automorphism keys) for a specific secret key tag :return: EvalKeyMap: key map :rtype: EvalKeyMap 
 - GetKeyGenLevel(self: openfhe.openfhe.CryptoContext) int
- For future use: getter for the level at which evaluation keys should be generated - Returns:
- The level used for key generation 
- Return type:
- int 
 
 - GetKeySwitchCount(self: openfhe.openfhe.CryptoContext) int
 - GetModulus(self: openfhe.openfhe.CryptoContext) float
- Getter for ciphertext modulus - Returns:
- modulus 
- Return type:
- int 
 
 - GetModulusCKKS(self: openfhe.openfhe.CryptoContext) int
 - GetMultiplicativeDepth(self: openfhe.openfhe.CryptoContext) int
 - GetNoiseEstimate(self: openfhe.openfhe.CryptoContext) float
 - GetPRENumHops(self: openfhe.openfhe.CryptoContext) int
 - GetPlaintextModulus(self: openfhe.openfhe.CryptoContext) int
- Get the plaintext modulus used for this context - Returns:
- The plaintext modulus 
- Return type:
- int 
 
 - GetRegisterWordSize(self: openfhe.openfhe.CryptoContext) int
 - GetRingDimension(self: openfhe.openfhe.CryptoContext) int
- Getter for ring dimension - Returns:
- The ring dimension 
- Return type:
- int 
 
 - GetScalingFactorReal(self: openfhe.openfhe.CryptoContext, arg0: SupportsInt) float
- Method to retrieve the scaling factor of level l. For FIXEDMANUAL scaling technique method always returns 2^p, where p corresponds to plaintext modulus - Parameters:
- l (int) – For FLEXIBLEAUTO scaling technique the level whose scaling factor we want to learn. Levels start from 0 (no scaling done - all towers) and go up to K-1, where K is the number of towers supported. 
- Returns:
- the scaling factor. 
- Return type:
- float 
 
 - GetScalingTechnique(self: openfhe.openfhe.CryptoContext) openfhe.openfhe.ScalingTechnique
 - static InsertEvalAutomorphismKey(evalKeyMap: openfhe.openfhe.EvalKeyMap, keyTag: str = '') None
- Add the given map of keys to the map, replacing the existing map if there is one - Parameters:
- evalKeyMap – map of keys to be inserted 
 - :type EvalKeyMap :param keyTag: key identifier for the given key map :type keyTag: str 
 - static InsertEvalMultKey(evalKeyVec: collections.abc.Sequence[openfhe.openfhe.EvalKey], keyTag: str = '') None
- Adds the given vector of keys to the map, replacing the existing vector if there - Parameters:
- evalKeyVec (List[EvalKey]) – vector of keys 
 
 - static InsertEvalSumKey(evalKeyMap: openfhe.openfhe.EvalKeyMap, keyTag: str = '') None
- InsertEvalSumKey - add the given map of keys to the map, replacing the existing map if there - Parameters:
- evalKeyMap (EvalKeyMap) – key map 
 
 - IntBootAdd(self: openfhe.openfhe.CryptoContext, ciphertext1: openfhe.openfhe.Ciphertext, ciphertext2: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Combines encrypted and unencrypted masked decryptions in 2-party interactive bootstrapping. It is the last step in the boostrapping. - Parameters:
- ciphertext1 (Ciphertext) – Encrypted masked decryption 
- ciphertext2 (Ciphertext) – Unencrypted masked decryption 
 
- Returns:
- Refreshed ciphertext 
- Return type:
 
 - IntBootAdjustScale(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Prepares a ciphertext for interactive bootstrapping. - Parameters:
- ciphertext (Ciphertext) – Input ciphertext 
- Returns:
- Adjusted ciphertext 
- Return type:
 
 - IntBootDecrypt(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Performs masked decryption for interactive bootstrapping (2-party protocol). - Parameters:
- privateKey (PrivateKey) – Secret key share 
- ciphertext (Ciphertext) – Input Ciphertext 
 
- Returns:
- Resulting ciphertext 
- Return type:
 
 - IntBootEncrypt(self: openfhe.openfhe.CryptoContext, publicKey: openfhe.openfhe.PublicKey, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Encrypts Client’s masked decryption for interactive bootstrapping. Increases ciphertext modulus to allow further computation. Done by Client. - Parameters:
- publicKey (PublicKey) – Joined public key (Threshold FHE) 
- ciphertext (Ciphertext) – Input Ciphertext 
 
- Returns:
- Resulting ciphertext 
- Return type:
 
 - IntMPBootAdd(self: openfhe.openfhe.CryptoContext, sharePairVec: collections.abc.Sequence[collections.abc.Sequence[openfhe.openfhe.Ciphertext]]) list[openfhe.openfhe.Ciphertext]
- Threshold FHE: Aggregates a vector of masked decryptions and re-encryotion shares, which is the second step of the interactive multiparty bootstrapping procedure. - Parameters:
- sharesPairVec (List[List[Ciphertext]]) – vector of pair of ciphertexts, each element of this vector contains (h_0i, h_1i) - the masked-decryption and encryption shares ofparty i 
- Returns:
- aggregated pair of shares ((h_0, h_1) 
- Return type:
- List[Ciphertext] 
 
 - IntMPBootAdjustScale(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Threshold FHE: Prepare a ciphertext for Multi-Party Interactive Bootstrapping. - Parameters:
- ciphertext (Ciphertext) – Input Ciphertext 
- Returns:
- Resulting Ciphertext 
- Return type:
 
 - IntMPBootDecrypt(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, ciphertext: openfhe.openfhe.Ciphertext, a: openfhe.openfhe.Ciphertext) list[openfhe.openfhe.Ciphertext]
- Threshold FHE: Does masked decryption as part of Multi-Party Interactive Bootstrapping. Each party calls this function as part of the protocol - Parameters:
- privateKey (PrivateKey) – secret key share for party i 
- ciphertext (Ciphertext) – input ciphertext 
- a (Ciphertext) – input common random polynomial 
 
- Returns:
- Resulting masked decryption 
- Return type:
 
 - IntMPBootEncrypt(self: openfhe.openfhe.CryptoContext, publicKey: openfhe.openfhe.PublicKey, sharePair: collections.abc.Sequence[openfhe.openfhe.Ciphertext], a: openfhe.openfhe.Ciphertext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Threshold FHE: Does public key encryption of lead party’s masked decryption as part of interactive multi-party bootstrapping, which increases the ciphertext modulus and enables future computations. This operation is done by the lead party as the final step of interactive multi-party bootstrapping. - Parameters:
- publicKey (PublicKey) – the lead party’s public key 
- sharesPair (List[Ciphertext]) – aggregated decryption and re-encryption shares 
- a (Ciphertext) – common random ring element 
- ciphertext (Ciphertext) – input ciphertext 
 
- Returns:
- Resulting encryption 
- Return type:
 
 - IntMPBootRandomElementGen(self: openfhe.openfhe.CryptoContext, publicKey: openfhe.openfhe.PublicKey) openfhe.openfhe.Ciphertext
- Threshold FHE: Generate a common random polynomial for Multi-Party Interactive Bootstrapping - Parameters:
- publicKey (PublicKey) – the scheme public key (you can also provide the lead party’s public-key) 
- Returns:
- Resulting ring element 
- Return type:
 
 - KeyGen(self: openfhe.openfhe.CryptoContext) openfhe.openfhe.KeyPair
- Generates a standard public/secret key pair. - Returns:
- a public/secret key pair 
- Return type:
 
 - KeySwitchGen(self: openfhe.openfhe.CryptoContext, oldPrivateKey: openfhe.openfhe.PrivateKey, newPrivateKey: openfhe.openfhe.PrivateKey) openfhe.openfhe.EvalKey
- Generates a key switching key from one secret key to another. - Parameters:
- oldPrivateKey (PrivateKey) – Original secret key. 
- newPrivateKey (PrivateKey) – Target secret key. 
 
- Returns:
- New evaluation key for key switching. 
- Return type:
- EvalKey 
 
 - MakeCKKSPackedPlaintext(*args, **kwargs)
- Overloaded function. - MakeCKKSPackedPlaintext(self: openfhe.openfhe.CryptoContext, value: collections.abc.Sequence[complex], scaleDeg: typing.SupportsInt = 1, level: typing.SupportsInt = 0, params: openfhe.openfhe.ParmType = None, slots: typing.SupportsInt = 0) -> openfhe.openfhe.Plaintext - COMPLEX ARITHMETIC IS NOT AVAILABLE, AND THIS METHOD BE DEPRECATED. USE THE REAL-NUMBER METHOD INSTEAD. MakeCKKSPackedPlaintext constructs a CKKSPackedEncoding in this context from a vector of complex numbers - param value:
- input vector of complex numbers 
- type value:
- List[complex] 
- param scaleDeg:
- degree of scaling factor used to encode the vector 
- type scaleDeg:
- int 
- param level:
- level at each the vector will get encrypted 
- type level:
- int 
- param params:
- parameters to be used for the ciphertext (Only accepting params = None in this version) 
- type params:
- openfhe.ParmType 
- param slots:
- number of slots 
- type slots:
- int 
- return:
- plaintext 
- rtype:
- Plaintext 
 
- MakeCKKSPackedPlaintext(self: openfhe.openfhe.CryptoContext, value: collections.abc.Sequence[typing.SupportsFloat], scaleDeg: typing.SupportsInt = 1, level: typing.SupportsInt = 0, params: openfhe.openfhe.ParmType = None, slots: typing.SupportsInt = 0) -> openfhe.openfhe.Plaintext - MakeCKKSPlaintext constructs a CKKSPackedEncoding in this context from a vector of real numbers - param value:
- input vector (of floats) 
- type value:
- list 
- param scaleDeg:
- degree of scaling factor used to encode the vector 
- type scaleDeg:
- int 
- param level:
- level at each the vector will get encrypted 
- type level:
- int 
- param params:
- parameters to be used for the ciphertext (Only accepting params = None in this version) 
- type params:
- openfhe.ParmType 
- param slots:
- number of slots 
- type slots:
- int 
- return:
- plaintext 
- rtype:
- Plaintext 
 
 
 - MakeCoefPackedPlaintext(self: openfhe.openfhe.CryptoContext, value: collections.abc.Sequence[SupportsInt], noiseScaleDeg: SupportsInt = 1, level: SupportsInt = 0) openfhe.openfhe.Plaintext
- MakeCoefPackedPlaintext constructs a CoefPackedEncoding in this context - Parameters:
- value (List[int]) – vector of signed integers mod t 
 - :param noiseScaleDeg : is degree of the scaling factor to encode the plaintext at :type noiseScaleDeg : int :param level: is the level to encode the plaintext at :type level: int :return: plaintext :rtype: Plaintext 
 - MakePackedPlaintext(self: openfhe.openfhe.CryptoContext, value: collections.abc.Sequence[SupportsInt], noiseScaleDeg: SupportsInt = 1, level: SupportsInt = 0) openfhe.openfhe.Plaintext
- MakePackedPlaintext constructs a PackedEncoding in this context - Parameters:
- value (List[int]) – vector of signed integers mod t 
- noiseScaleDeg (int) – is degree of the scaling factor to encode the plaintext at 
- level (int) – is the level to encode the plaintext at 
 
- Returns:
- plaintext 
- Return type:
 
 - MakeStringPlaintext(self: openfhe.openfhe.CryptoContext, str: str) openfhe.openfhe.Plaintext
- MakeStringPlaintext constructs a StringEncoding in this context. - Parameters:
- str (str) – string to be encoded 
- Returns:
- plaintext 
 
 - ModReduce(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- ModReduce - OpenFHE ModReduce method used only for BGV/CKKS. - Parameters:
- ciphertext (Ciphertext) – ciphertext 
- Returns:
- Ciphertext: mod reduced ciphertext 
- Return type:
 
 - ModReduceInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) None
- ModReduce - OpenFHE ModReduceInPlace method used only for BGV/CKKS. - Parameters:
- ciphertext (Ciphertext) – ciphertext to be mod-reduced in-place 
 
 - MultiAddEvalAutomorphismKeys(self: openfhe.openfhe.CryptoContext, evalKeyMap1: openfhe.openfhe.EvalKeyMap, evalKeyMap1: openfhe.openfhe.EvalKeyMap, keyTag: str = '') openfhe.openfhe.EvalKeyMap
- Threshold FHE: Adds two prior evaluation key sets for automorphisms - Parameters:
- evalKeyMap1 (EvalKeyMap) – first automorphism key set 
- evalKeyMap2 (EvalKeyMap) – second automorphism key set 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- the new joined key set for summation 
- Return type:
- evalKeyMap 
 
 - MultiAddEvalKeys(self: openfhe.openfhe.CryptoContext, evalKey1: openfhe.openfhe.EvalKey, evalKey2: openfhe.openfhe.EvalKey, keyTag: str = '') openfhe.openfhe.EvalKey
- Threshold FHE: Adds two prior evaluation keys - Parameters:
- evalKey1 (EvalKey) – first evaluation key 
- evalKey2 (EvalKey) – second evaluation key 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- the new joined key 
- Return type:
- EvalKey 
 
 - MultiAddEvalMultKeys(self: openfhe.openfhe.CryptoContext, evalKey1: openfhe.openfhe.EvalKey, evalKey2: openfhe.openfhe.EvalKey, keyTag: str = '') openfhe.openfhe.EvalKey
- Threshold FHE: Adds two prior evaluation key sets for summation - Parameters:
- evalKey1 (EvalKey) – first evaluation key 
- evalKey2 (EvalKey) – second evaluation key 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- the new joined key 
- Return type:
- EvalKey 
 
 - MultiAddEvalSumKeys(self: openfhe.openfhe.CryptoContext, evalKeyMap1: openfhe.openfhe.EvalKeyMap, evalKeyMap2: openfhe.openfhe.EvalKeyMap, keyTag: str = '') openfhe.openfhe.EvalKeyMap
- Threshold FHE: Adds two prior evaluation key sets for summation - Parameters:
- evalKeyMap1 (EvalKeyMap) – first summation key set 
- evalKeyMap2 (EvalKeyMap) – second summation key set 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- the neew joined key set for summation 
- Return type:
- EvalKeyMap 
 
 - MultiAddPubKeys(self: openfhe.openfhe.CryptoContext, publicKey1: openfhe.openfhe.PublicKey, publicKey2: openfhe.openfhe.PublicKey, keyTag: str = '') openfhe.openfhe.PublicKey
- Threshold FHE: Adds two prior public keys 
 - MultiEvalAtIndexKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, evalKeyMap: openfhe.openfhe.EvalKeyMap, indexList: collections.abc.Sequence[SupportsInt], keyTag: str = '') openfhe.openfhe.EvalKeyMap
- Threshold FHE: Generates joined rotation keys from the current secret key and prior joined rotation keys - Parameters:
- privateKey (PrivateKey) – secret key share 
- evalKeyMap (EvalKeyMap) – a map with prior joined rotation keys 
- indexList (List[int32]) – a vector of rotation indices 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- EvalKeyMap: a map with new joined rotation keys 
- Return type:
- EvalKeyMap 
 
 - MultiEvalSumKeyGen(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, evalKeyMap: openfhe.openfhe.EvalKeyMap, keyTag: str = '') openfhe.openfhe.EvalKeyMap
- Threshold FHE: Generates joined summation evaluation keys from the current secret share and prior joined summation keys - Parameters:
- privateKey (PrivateKey) – secret key share 
- evalKeyMap (EvalKeyMap) – a map with prior joined summation keys 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- EvalKeyMap: new joined summation keys 
- Return type:
- EvalKeyMap 
 
 - MultiKeySwitchGen(self: openfhe.openfhe.CryptoContext, originalPrivateKey: openfhe.openfhe.PrivateKey, newPrivateKey: openfhe.openfhe.PrivateKey, evalKey: openfhe.openfhe.EvalKey) openfhe.openfhe.EvalKey
- Threshold FHE: Generates a joined evaluation key from the current secret share and a prior joined evaluation key - Parameters:
- originalPrivateKey (PrivateKey) – secret key transformed from. 
- newPrivateKey (PrivateKey) – secret key transformed from. 
- evalKey (EvalKey) – the prior joined evaluation key. 
 
- Returns:
- EvalKey: the new joined evaluation key. 
- Return type:
- EvalKey 
 
 - MultiMultEvalKey(self: openfhe.openfhe.CryptoContext, privateKey: openfhe.openfhe.PrivateKey, evalKey: openfhe.openfhe.EvalKey, keyTag: str = '') openfhe.openfhe.EvalKey
- Threshold FHE: Generates a partial evaluation key for homomorphic multiplication based on the current secret share and an existing partial evaluation key - Parameters:
- privateKey (PrivateKey) – current secret share 
- evalKey (EvalKey) – prior evaluation key 
- keyId (str) – new key identifier used for resulting evaluation key 
 
- Returns:
- the new joined key 
- Return type:
- EvalKey 
 
 - MultipartyDecryptFusion(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext]) openfhe.openfhe.Plaintext
- Threshold FHE: Method for combining the partially decrypted ciphertexts and getting the final decryption in the clear. - Parameters:
- partialCiphertextVec (list) – list of “partial” decryptions 
- Returns:
- Plaintext: resulting plaintext 
- Return type:
 
 - MultipartyDecryptLead(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext], privateKey: openfhe.openfhe.PrivateKey) list[openfhe.openfhe.Ciphertext]
- Threshold FHE: Method for decryption operation run by the lead decryption client - Parameters:
- ciphertextVec (list) – a list of ciphertexts 
- privateKey (PrivateKey) – secret key share used for decryption. 
 
- Returns:
- list of partially decrypted ciphertexts. 
- Return type:
- List[Ciphertext] 
 
 - MultipartyDecryptMain(self: openfhe.openfhe.CryptoContext, ciphertextVec: collections.abc.Sequence[openfhe.openfhe.Ciphertext], privateKey: openfhe.openfhe.PrivateKey) list[openfhe.openfhe.Ciphertext]
- Threshold FHE: “Partial” decryption computed by all parties except for the lead one - Parameters:
- ciphertextVec (list) – a list of ciphertexts 
- privateKey (PrivateKey) – secret key share used for decryption. 
 
- Returns:
- list of partially decrypted ciphertexts. 
- Return type:
- List[Ciphertext] 
 
 - MultipartyKeyGen(*args, **kwargs)
- Overloaded function. - MultipartyKeyGen(self: openfhe.openfhe.CryptoContext, publicKey: openfhe.openfhe.PublicKey, makeSparse: bool = False, fresh: bool = False) -> openfhe.openfhe.KeyPair - Threshold FHE: Generation of a public key derived from a previous joined public key (for prior secret shares) and the secret key share of the current party. - param publicKey:
- joined public key from prior parties. 
- type publicKey:
- PublicKey 
- param makeSparse:
- set to true if ring reduce by a factor of 2 is to be used. NOT SUPPORTED BY ANY SCHEME ANYMORE. 
- type makeSparse:
- bool 
- param fresh:
- set to true if proxy re-encryption is used in the multi-party protocol or star topology is used 
- type fresh:
- bool 
- return:
- KeyPair: key pair including the secret share for the current party and joined public key 
- rtype:
- KeyPair 
 
- MultipartyKeyGen(self: openfhe.openfhe.CryptoContext, privateKeyVec: collections.abc.Sequence[openfhe.openfhe.PrivateKey]) -> openfhe.openfhe.KeyPair - Threshold FHE: Generates a public key from a vector of secret shares. ONLY FOR DEBUGGIN PURPOSES. SHOULD NOT BE USED IN PRODUCTION. - param privateKeyVec:
- secret key shares. 
- type privateKeyVec:
- List[PrivateKey] 
- return KeyPair:
- key pair including the private for the current party and joined public key 
- rtype:
- KeyPair 
 
 
 - ReEncrypt(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext, evalKey: openfhe.openfhe.EvalKey, publicKey: openfhe.openfhe.PublicKey = None) openfhe.openfhe.Ciphertext
- ReEncrypt - Proxy Re-Encryption mechanism for OpenFHE - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- evalKey (EvalKey) – evaluation key for PRE keygen method 
- publicKey (PublicKey) – the public key of the recipient of the reencrypted ciphertext 
 
- Returns:
- the resulting ciphertext 
- Return type:
 
 - ReKeyGen(self: openfhe.openfhe.CryptoContext, oldPrivateKey: openfhe.openfhe.PrivateKey, newPublicKey: openfhe.openfhe.PublicKey) openfhe.openfhe.EvalKey
- ReKeyGen produces an Eval Key that OpenFHE can use for Proxy Re-Encryption - Parameters:
- oldPrivateKey – original private key 
- newPublicKey – public key 
 
- Returns:
- new evaluation key 
- Return type:
- EvalKey 
 
 - Relinearize(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Homomorphic multiplication of two ciphertexts withour relinearization - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
- Returns:
- relinearized ciphertext 
- Return type:
 
 - RelinearizeInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) None
- In-place relinearization of a ciphertext to the lowest level (with 2 polynomials per ciphertext). - Parameters:
- ciphertext (Ciphertext) – input ciphertext 
 
 - Rescale(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) openfhe.openfhe.Ciphertext
- Rescale - An alias for OpenFHE ModReduce method. This is because ModReduce is called Rescale in CKKS. - Parameters:
- ciphertext (Ciphertext) – ciphertext 
- Returns:
- Ciphertext: rescaled ciphertext 
- Return type:
 
 - RescaleInPlace(self: openfhe.openfhe.CryptoContext, ciphertext: openfhe.openfhe.Ciphertext) None
- Rescale - An alias for OpenFHE ModReduceInPlace method. This is because ModReduceInPlace is called RescaleInPlace in CKKS. - Parameters:
- ciphertext (Ciphertext) – ciphertext to be rescaled in-place 
 
 - static SerializeEvalAutomorphismKey(*args, **kwargs)
- Overloaded function. - SerializeEvalAutomorphismKey(filename: str, sertype: openfhe.openfhe.SERBINARY, keyTag: str = ‘’) -> bool - SerializeEvalAutomorphismKey for a single EvalAuto key or all of the EvalAuto keys - param filename:
- output file 
- type filename:
- str 
- param sertype:
- serialization type 
- type sertype:
- SERJSON, SERBINARY 
- param id:
- key to serialize; empty string means all keys 
- type id:
- str 
- return:
- bool: true on success 
 
- SerializeEvalAutomorphismKey(filename: str, sertype: openfhe.openfhe.SERJSON, keyTag: str = ‘’) -> bool - SerializeEvalAutomorphismKey for a single EvalAuto key or all of the EvalAuto keys - param filename:
- output file 
- type filename:
- str 
- param sertype:
- serialization type 
- type sertype:
- SERJSON, SERBINARY 
- param id:
- key to serialize; empty string means all keys 
- type id:
- str 
- return:
- bool: true on success 
 
 
 - static SerializeEvalMultKey(*args, **kwargs)
- Overloaded function. - SerializeEvalMultKey(filename: str, sertype: openfhe.openfhe.SERBINARY, keyTag: str = ‘’) -> bool - SerializeEvalMultKey for a single EvalMult key or all of the EvalMult keys - param filename:
- output file to serialize to 
- type filename:
- str 
- param sertype:
- type of serialization 
- type sertype:
- SERJSON, SERBINARY 
- param id:
- for key to serialize - if empty string, serialize them all 
- type id:
- str 
- return:
- bool: true on success (false on failure or no keys found) 
 
- SerializeEvalMultKey(filename: str, sertype: openfhe.openfhe.SERJSON, keyTag: str = ‘’) -> bool - SerializeEvalMultKey for a single EvalMult key or all of the EvalMult keys - param filename:
- output file to serialize to 
- type filename:
- str 
- param sertype:
- type of serialization 
- type sertype:
- SERJSON, SERBINARY 
- param id:
- for key to serialize - if empty string, serialize them all 
- type id:
- str 
- return:
- bool: true on success (false on failure or no keys found) 
 
 
 - SetEvalAddCount(self: openfhe.openfhe.CryptoContext, evalAddCount: SupportsInt) None
 - SetKeyGenLevel(self: openfhe.openfhe.CryptoContext, level: SupportsInt) None
- For future use: setter for the level at which evaluation keys should be generated - Parameters:
- level (int) – the level to set the key generation to 
 
 - SetKeySwitchCount(self: openfhe.openfhe.CryptoContext, keySwitchCount: SupportsInt) None
 - SetMultiplicativeDepth(self: openfhe.openfhe.CryptoContext, multiplicativeDepth: SupportsInt) None
 - SetNoiseEstimate(self: openfhe.openfhe.CryptoContext, noiseEstimate: SupportsFloat) None
 - SetPRENumHops(self: openfhe.openfhe.CryptoContext, PRENumHops: SupportsInt) None
 - get_ptr(self: openfhe.openfhe.CryptoContext) None