API reference
Note that most types and functions provided by OpenFHE.jl are generated automatically by CxxWrap.jl's @wrapmodule macro. Therefore, docstrings are attached to just the respective symbol and not the actual code location. The goal of this reference is thus chiefly to save the user/developer the hassle of having to go to the (authoritative) OpenFHE documentation each time they need to use OpenFHE.jl in Julia. Note that the documented types for function arguments are not necessarily identical to those imposed by the Julia code, but chosen to be more descriptive. For example, functions expecting enum arguments often allow any Integer value to be passed, but we document the function signature with the enum type instead.
If in doubt, please consult the official OpenFHE documentation.
OpenFHE.ADVANCEDSHE — Constant
OpenFHE.BV — Constant
KeySwitchTechniqueEnum type for selecting the key switching technique in a set of CCParams parameters using SetKeySwitchTechnique.
Instances are:
INVALID_KS_TECHBVHYBRID
See also: SetKeySwitchTechnique
OpenFHE.FHE — Constant
OpenFHE.FIXEDAUTO — Constant
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.FIXEDMANUAL — Constant
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.FLEXIBLEAUTO — Constant
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.FLEXIBLEAUTOEXT — Constant
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.GAUSSIAN — Constant
SecretKeyDistEnum type for selecting the distribution from which the secret key is generated. To be used in a set of CCParams parameters using SetSecretKeyDist.
Instances are:
GAUSSIANUNIFORM_TERNARYSPARSE_TERNARY
See also: SetSecretKeyDist
OpenFHE.HEStd_128_classic — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HEStd_128_quantum — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HEStd_192_classic — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HEStd_192_quantum — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HEStd_256_classic — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HEStd_256_quantum — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HEStd_NotSet — Constant
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.HYBRID — Constant
KeySwitchTechniqueEnum type for selecting the key switching technique in a set of CCParams parameters using SetKeySwitchTechnique.
Instances are:
INVALID_KS_TECHBVHYBRID
See also: SetKeySwitchTechnique
OpenFHE.INVALID_KS_TECH — Constant
KeySwitchTechniqueEnum type for selecting the key switching technique in a set of CCParams parameters using SetKeySwitchTechnique.
Instances are:
INVALID_KS_TECHBVHYBRID
See also: SetKeySwitchTechnique
OpenFHE.INVALID_RS_TECHNIQUE — Constant
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.KEYSWITCH — Constant
OpenFHE.LEVELEDSHE — Constant
OpenFHE.MULTIPARTY — Constant
OpenFHE.NORESCALE — Constant
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.PKE — Constant
OpenFHE.PRE — Constant
OpenFHE.SCHEMESWITCH — Constant
OpenFHE.SPARSE_TERNARY — Constant
SecretKeyDistEnum type for selecting the distribution from which the secret key is generated. To be used in a set of CCParams parameters using SetSecretKeyDist.
Instances are:
GAUSSIANUNIFORM_TERNARYSPARSE_TERNARY
See also: SetSecretKeyDist
OpenFHE.UNIFORM_TERNARY — Constant
SecretKeyDistEnum type for selecting the distribution from which the secret key is generated. To be used in a set of CCParams parameters using SetSecretKeyDist.
Instances are:
GAUSSIANUNIFORM_TERNARYSPARSE_TERNARY
See also: SetSecretKeyDist
OpenFHE.CCParams — Type
CCParams{T}Type to store parameters for a generating a cryptographic context in OpenFHE using GenCryptoContext.
Use CCParams{CryptoContextBFVRNS}() to create a parameter store that can be used to generate a cryptographic context for BFV-encrypted operations. Use CCParams{CryptoContextBGVRNS}() to create a parameter store that can be used to generate a cryptographic context for BGV-encrypted operations. Use CCParams{CryptoContextCKKSRNS}() to create a parameter store that can be used to generate a cryptographic context for CKKS-encrypted operations.
See also: CryptoContextBFVRNS, CryptoContextBGVRNS, CryptoContextCKKSRNS, GenCryptoContext
OpenFHE.Ciphertext — Type
OpenFHE.CryptoContext — Type
CryptoContext{T}Type alias for CxxWrap.StdLib.SharedPtr{CryptoContextImpl{T}}.
The crypto context is the central object in OpenFHE that facilitates all essential cryptographic operations such as key generation, encryption/decryption, arithmetic operations on plaintexts and ciphertexts etc.
In OpenFHE, a crypto context is always created from a set of CCParams parameters using GenCryptoContext.
See also: CCParams, GenCryptoContext
OpenFHE.CryptoContextBFVRNS — Type
OpenFHE.CryptoContextBGVRNS — Type
OpenFHE.CryptoContextCKKSRNS — Type
OpenFHE.DCRTPoly — Type
DCRTPolyA type used as a parameter for many parametric data types (e.g., CryptoContext or Ciphertext) to indicate how some fundamental lattice operations are encoded in OpenFHE. Usually this type never needs to be constructed directly by a user.
See also: CryptoContext
OpenFHE.DecryptResult — Type
OpenFHE.EncodingParams — Type
EncodingParamsType alias for CxxWrap.StdLib.SharedPtr{EncodingParamsImpl}.
The EncodingParams store the parameters for encoding. These parameters are kept with multiple OpenFHE objects and are continually reused during the encoding of new values.
OpenFHE.KeyPair — Type
KeyPair{T}Data type to hold a public/private key combination for encrypting/decrypting data. A key pair is usually generated by calling KeyGen.
To extract the public or private key from a key pair, use OpenFHE.public_key and OpenFHE.private_key respectively. Since these are not functions provided by OpenFHE but only by OpenFHE.jl, they are not exported.
See also: KeyGen, CryptoContext, PublicKey, PrivateKey, OpenFHE.public_key, OpenFHE.private_key
OpenFHE.KeySwitchTechnique — Type
KeySwitchTechniqueEnum type for selecting the key switching technique in a set of CCParams parameters using SetKeySwitchTechnique.
Instances are:
INVALID_KS_TECHBVHYBRID
See also: SetKeySwitchTechnique
OpenFHE.PKESchemeFeature — Type
OpenFHE.Plaintext — Type
PlaintextType alias for CxxWrap.StdLib.SharedPtr{PlaintextImpl}.
The plaintext object can hold unencrypted data. It is created either by encoding raw data (e.g., through MakeCKKSPackedPlaintext) or by decrypting a Ciphertext object using Decrypt.
See also: Ciphertext, Decrypt
OpenFHE.PrivateKey — Type
PrivateKey{T}Type alias for CxxWrap.StdLib.SharedPtr{PrivateKeyImpl{T}}.
Private keys can be used to decrypt Ciphertext data into Plaintext objects. They are part of a KeyPair that contains both a public and a private key. Key pairs can be created from a CryptoContext by calling KeyGen.
OpenFHE.PublicKey — Type
PublicKey{T}Type alias for CxxWrap.StdLib.SharedPtr{PublicKeyImpl{T}}.
Public keys can be used to encrypt Plaintext data into Ciphertext objects. They are part of a KeyPair that contains both a public and a private key. Key pairs can be created from a CryptoContext by calling KeyGen.
OpenFHE.ScalingTechnique — Type
ScalingTechniqueEnum type for selecting the scaling technique for ciphertext multiplication in a set of CCParams parameters using SetScalingTechnique.
Instances are:
FIXEDMANUALFIXEDAUTOFLEXIBLEAUTOFLEXIBLEAUTOEXTNORESCALEINVALID_RS_TECHNIQUE
See also: SetScalingTechnique
OpenFHE.SecretKeyDist — Type
SecretKeyDistEnum type for selecting the distribution from which the secret key is generated. To be used in a set of CCParams parameters using SetSecretKeyDist.
Instances are:
GAUSSIANUNIFORM_TERNARYSPARSE_TERNARY
See also: SetSecretKeyDist
OpenFHE.SecurityLevel — Type
SecurityLevel Enum type for specifying the security level according to the homomorphic encryption standard in a set of CCParams parameters using SetSecurityLevel.
Instances are:
HEStd_128_classicHEStd_192_classicHEStd_256_classicHEStd_128_quantumHEStd_192_quantumHEStd_256_quantumHEStd_NotSet
See also: SetSecurityLevel
OpenFHE.ClearEvalAutomorphismKeys — Function
ClearEvalAutomorphismKeys()
ClearEvalAutomorphismKeys(id::String)
ClearEvalAutomorphismKeys(crypto_context::CryptoContext)Clear EvalAutomorphismKey cache fully.
Clear EvalAutomorphismKey cache for a given key id.
Clear EvalAutomorphismKey cache for a given crypto_context
See also: CryptoContext, EvalBootstrapKeyGen, EvalBootstrap, EvalRotateKeyGen, EvalRotate, ClearEvalMultKeys, ClearEvalSumKeys
OpenFHE.ClearEvalMultKeys — Function
ClearEvalMultKeys()
ClearEvalMultKeys(id::String)
ClearEvalMultKeys(crypto_context::CryptoContext)Clear EvalMultKey cache fully.
Clear EvalMultKey cache for a given key id.
Clear EvalMultKey cache for a given crypto_context
See also: CryptoContext, EvalMultKeyGen, EvalMult, ClearEvalSumKeys, ClearEvalAutomorphismKeys
OpenFHE.ClearEvalSumKeys — Function
ClearEvalSumKeys()
ClearEvalSumKeys(id::String)
ClearEvalSumKeys(crypto_context::CryptoContext)Clear EvalSumKey cache fully.
Clear EvalSumKey cache for a given key id.
Clear EvalSumKey cache for a given crypto_context
See also: CryptoContext, EvalSumKeyGen, EvalSum, ClearEvalMultKeys, ClearEvalAutomorphismKeys
OpenFHE.Clone — Function
Clone(ciphertext::Ciphertext)Clone the given ciphertext including its encrypted data.
See also: Ciphertext, CloneZero
OpenFHE.CloneZero — Function
CloneZero(ciphertext::Ciphertext)Clone the given ciphertext without its encrypted data.
See also: Ciphertext, Clone
OpenFHE.ComposedEvalMult — Function
ComposedEvalMult(crypto_context::CryptoContext, ciphertext1::Ciphertext, ciphertext2::Ciphertext)Multiply ciphertext1 with ciphertext2, perform relinearization and modulus switching/rescaling. Return the resulting Ciphertext. Both input ciphertexts need to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext
OpenFHE.Compress — Method
Compress(crypto_context::CryptoContext, ciphertext::Ciphertext; levels_left = 1, noise_scale_deg = 1)Return a compressed ciphertext with modulus reduced to a number of multiplicative levels levels_left and noise scale degree noise_scale_deg.
See also: CryptoContext, Ciphertext
OpenFHE.Decrypt — Method
Decrypt(crypto_context::CryptoContext, ciphertext::Ciphertext, private_key::PrivateKey, plaintext::Plaintext)
Decrypt(crypto_context::CryptoContext, private_key::PrivateKey, ciphertext::Ciphertext, plaintext::Plaintext)Decrypt a ciphertext with the given private_key and store the result in plaintext, using the parameters of the given crypto_context.
See also: CryptoContext, PrivateKey, Ciphertext, Plaintext, Encrypt
OpenFHE.Enable — Function
Enable(crypto_context::CryptoContext, feature::PKESchemeFeature)Enable a certain public key encryption feature in the given crypto_context.
See also: CryptoContext, PKESchemeFeature
OpenFHE.Encrypt — Function
Encrypt(crypto_context::CryptoContext, public_key::PublicKey, plaintext::Plaintext)Encrypt a given Plaintext object into a Ciphertext using the given public_key and using the parameters of the crypto_context.
See also: CryptoContext, PublicKey, Decrypt
OpenFHE.EvalAdd — Function
EvalAdd(crypto_context::CryptoContext, ciphertext1::Ciphertext, ciphertext2::Ciphertext)
EvalAdd(crypto_context::CryptoContext, ciphertext::Ciphertext, plaintext::Plaintext)
EvalAdd(crypto_context::CryptoContext, plaintext::Plaintext, ciphertext::Ciphertext)
EvalAdd(crypto_context::CryptoContext, ciphertext::Ciphertext, scalar::Real)
EvalAdd(crypto_context::CryptoContext, scalar::Real, ciphertext::Ciphertext)Add ciphertext1 to ciphertext2 and return the resulting Ciphertext. Both input ciphertexts need to be derived from the given crypto_context.
Add plaintext to the ciphertext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context, while the plaintext needs to be encoded in a compatible manner
Add the real-valued scalar element-wise to ciphertext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, Plaintext
OpenFHE.EvalBootstrap — Method
EvalBootstrap(crypto_context::CryptoContext, ciphertext::Ciphertext;
num_iterations = 1,
precision = 0)Return a refreshed ciphertext for a given crypto_context. Supported for CKKS only. Please refer to the OpenFHE documentation for details on the remaining arguments.
See also: CryptoContext, PrivateKey, EvalBootstrapSetup, EvalBootstrap
OpenFHE.EvalBootstrapKeyGen — Function
EvalBootstrapKeyGen(crypto_context::CryptoContext, private_key::PrivateKey, num_slots::Integer)Generate the necessary keys from private_key to enable bootstrapping for a given crypto_context and num_slots slots. Supported for CKKS only.
See also: CryptoContext, PrivateKey, EvalBootstrapSetup, EvalBootstrap
OpenFHE.EvalBootstrapSetup — Method
EvalBootstrapSetup(crypto_context::CryptoContext;
level_budget::Vector{<:Integer} = [5, 4],
dim1::Vector{<:Integer} = [0, 0],
slots = 0,
correction_factor = 0,
precompute = true)Set up a given crypto_context for bootstrapping. Supported for CKKS only. Please refer to the OpenFHE documentation for details on the remaining arguments.
See also: CryptoContext, EvalBootstrapKeyGen, EvalBootstrap
OpenFHE.EvalCos — Function
EvalCos(crypto_context::CryptoContext, ciphertext::Ciphertext, a::Float64, b::Float64,
degree::Integer)Evaluate approximate cosine function on a given ciphertext using the Chebyshev approximation over the range $[a,b]$. Return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
a is a lower bound of elements contained in the given ciphertext.
b is an upper bound of elements contained in the given ciphertext.
degree is a desired degree of approximation.
Supported only in CKKS.
See also: CryptoContext, Ciphertext, EvalSin
OpenFHE.EvalDivide — Function
EvalDivide(crypto_context::CryptoContext, ciphertext::Ciphertext, a::Float64, b::Float64,
degree::Integer)Evaluate approximate division function $\frac{1}{x}$ where $x >= 1$ on a given ciphertext using the Chebyshev approximation over the range $[a,b]$. Return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
x is an element contained in the given ciphertext
a is a lower bound of elements contained in the given ciphertext.
b is an upper bound of elements contained in the given ciphertext.
degree is a desired degree of approximation.
Supported only in CKKS.
See also: CryptoContext, Ciphertext
OpenFHE.EvalLogistic — Function
EvalLogistic(crypto_context::CryptoContext, ciphertext::Ciphertext, a::Float64, b::Float64,
degree::Integer)Evaluate approximate logistic function $\frac{1}{1 + \exp{-x}}$ on a given ciphertext using the Chebyshev approximation over the range $[a,b]$. Return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
x is an element contained in the given ciphertext
a is a lower bound of elements contained in the given ciphertext.
b is an upper bound of elements contained in the given ciphertext.
degree is a desired degree of approximation.
Supported only in CKKS.
See also: CryptoContext, Ciphertext
OpenFHE.EvalMult — Function
EvalMult(crypto_context::CryptoContext, ciphertext1::Ciphertext, ciphertext2::Ciphertext)
EvalMult(crypto_context::CryptoContext, ciphertext::Ciphertext, plaintext::Plaintext)
EvalMult(crypto_context::CryptoContext, plaintext::Plaintext, ciphertext::Ciphertext)
EvalMult(crypto_context::CryptoContext, ciphertext::Ciphertext, scalar::Real)
EvalMult(crypto_context::CryptoContext, scalar::Real, ciphertext::Ciphertext)Multiply ciphertext1 with ciphertext2 and return the resulting Ciphertext. Both input ciphertexts need to be derived from the given crypto_context.
Multiply ciphertext with the plaintext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context, while the plaintext needs to be encoded in a compatible manner
Multiply ciphertext with the real-valued scalar and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, Plaintext
OpenFHE.EvalMultKeyGen — Function
EvalMultKeyGen(crypto_context::CryptoContext, private_key::PrivateKey)Generate relinearization key for use with EvalMult using the private_key, and store it in the given crypto_context.
See also: CryptoContext, PrivateKey, EvalMult
OpenFHE.EvalMultNoRelin — Function
EvalMultNoRelin(crypto_context::CryptoContext, ciphertext1::Ciphertext, ciphertext2::Ciphertext)Multiply ciphertext1 with ciphertext2 without relinearization and return the resulting Ciphertext. Both input ciphertexts need to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext
OpenFHE.EvalNegate — Function
EvalNegate(crypto_context::CryptoContext, ciphertext::Ciphertext)Negate the ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext
OpenFHE.EvalRotate — Function
EvalRotate(crypto_context::CryptoContext, ciphertext::Ciphertext, index::Integer)Rotate the ciphertext by the given index. A positive index denotes a left shift, a negative index a right shift. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext
OpenFHE.EvalRotateKeyGen — Method
EvalRotateKeyGen(crypto_context::CryptoContext,
private_key::PrivateKey,
index_list::Vector{<:Integer};
public_key::PublicKey = C_NULL)Generate rotation keys for use with EvalRotate using the private_key and for the rotation indices in index_list. The keys are stored in the givencrypto_context`. Please refer to the OpenFHE documentation for details on the remaining arguments.
See also: CryptoContext, PrivateKey, PublicKey, EvalRotate
OpenFHE.EvalSin — Function
EvalSin(crypto_context::CryptoContext, ciphertext::Ciphertext, a::Float64, b::Float64,
degree::Integer)Evaluate approximate sine function on a given ciphertext using the Chebyshev approximation over the range $[a,b]$. Return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
a is a lower bound of elements contained in the given ciphertext.
b is an upper bound of elements contained in the given ciphertext.
degree is a desired degree of approximation.
Supported only in CKKS.
See also: CryptoContext, Ciphertext, EvalCos
OpenFHE.EvalSquare — Function
EvalSquare(crypto_context::CryptoContext, ciphertext::Ciphertext)Perform efficient homomorphic squaring of a ciphertext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext
OpenFHE.EvalSub — Function
EvalSub(crypto_context::CryptoContext, ciphertext1::Ciphertext, ciphertext2::Ciphertext)
EvalSub(crypto_context::CryptoContext, ciphertext::Ciphertext, plaintext::Plaintext)
EvalSub(crypto_context::CryptoContext, plaintext::Plaintext, ciphertext::Ciphertext)
EvalSub(crypto_context::CryptoContext, ciphertext::Ciphertext, scalar::Real)
EvalSub(crypto_context::CryptoContext, scalar::Real, ciphertext::Ciphertext)Subtract ciphertext2 from ciphertext1 and return the resulting Ciphertext. Both input ciphertexts need to be derived from the given crypto_context.
Subtract plaintext from ciphertext (or vice-versa) and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context, while the plaintext needs to be encoded in a compatible manner
Subtract the real-valued scalar element-wise from ciphertext (or vice-versa) and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, Plaintext
OpenFHE.EvalSum — Function
EvalSum(crypto_context::CryptoContext, ciphertext::Ciphertext, batch_size::Integer)Calculate sum of all elements contained in the given ciphertext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, EvalSumKeyGen
OpenFHE.EvalSumKeyGen — Method
EvalSumKeyGen(crypto_context::CryptoContext, private_key::PrivateKey;
public_key::PublicKey = C_NULL)Generates the key map to be used by EvalSum. public_key has to be set for NTRU schemes.
Please refer to the OpenFHE documentation for more details.
See also: CryptoContext, PrivateKey, PublicKey, EvalSum
OpenFHE.GenCryptoContext — Function
GenCryptoContext(parameters::CCParams)::CryptoContext
GenCryptoContext(parameters::CCParams{CryptoContextBFVRNS})::CryptoContext{DCRTYPoly}
GenCryptoContext(parameters::CCParams{CryptoContextBGVRNS})::CryptoContext{DCRTYPoly}
GenCryptoContext(parameters::CCParams{CryptoContextCKKSRNS})::CryptoContext{DCRTYPoly}Generate a crypto context from a set of parameters. The exact return type depends on the parameter set type.
See also: CryptoContext, CCParams
OpenFHE.GetAllContexts — Function
OpenFHE.GetBatchSize — Function
GetBatchSize(parameters::EncodingParams)::UInt32Return the plaintext batch size used by the given parameters.
See also: EncodingParams, SetBatchSize
OpenFHE.GetBootstrapDepth — Method
GetBootstrapDepth(level_budget::Vector{<:Integer}, secret_key_distribution::SecretKeyDist)Compute and return the bootstrapping depth for a given level_budget and a secret_key_distribution.
See also: SecretKeyDist
OpenFHE.GetCoefPackedValue — Function
OpenFHE.GetContextCount — Function
GetContextCount()Return number of CryptoContexts stored in CryptoContextFactory.
See also: CryptoContext
OpenFHE.GetCryptoContext — Method
GetCryptoContext(object::Union{Ciphertext})Return a the crypto context for a an object that is is a subtype of CryptoObject.
Currently, this is only implemented for Ciphertext.
See also: CryptoContext, Ciphertext
OpenFHE.GetCyclotomicOrder — Function
GetCyclotomicOrder(crypto_context::CryptoContext)::UInt32Return the cyclotomic order used for a given crypto_context.
See also: CryptoContext
OpenFHE.GetElementRingDimension — Function
OpenFHE.GetEncodingParameters — Function
GetEncodingParameters(object::Union{Ciphertext})Return the EncodingParams used by the given object that is is a subtype of CryptoObject.
Currently, this is only implemented for Ciphertext.
See also: EncodingParams, Ciphertext
OpenFHE.GetEncodingParams — Function
GetEncodingParams(plaintext::Plaintext)Return the EncodingParams used by the given plaintext.
See also: Plaintext, EncodingParams
OpenFHE.GetFullContextByDeserializedContext — Function
GetFullContextByDeserializedContext(crypto_context::CryptoContext)Return the full CryptoContext based on partial information we usually get from a de-serialized crypto_context.
See also: CryptoContext
OpenFHE.GetHopLevel — Function
GetHopLevel(ciphertext::Ciphertext)Return the re-encryption level for the given ciphertext.
See also: Ciphertext, SetHopLevel
OpenFHE.GetKeyGenLevel — Function
GetKeyGenLevel(crypto_context::CryptoContext)::UInt32For future use: Return level at which evaluation keys should be generated for the given crypto_context.
See also: CryptoContext, SetKeyGenLevel
OpenFHE.GetLevel — Function
GetLevel(ciphertext::Ciphertext)
GetLevel(plaintext::Plaintext)Return the number of scalings performed for the given ciphertext or plaintext..
See also: Ciphertext, Plaintext, SetLevel
OpenFHE.GetLogError — Function
OpenFHE.GetLogPrecision — Function
OpenFHE.GetModulus — Function
GetModulus(crypto_context::CryptoContext)::UInt32Return the ciphertext modulus used for a given crypto_context.
See also: CryptoContext
OpenFHE.GetNoiseScaleDeg — Function
GetNoiseScaleDeg(ciphertext::Ciphertext)
GetNoiseScaleDeg(plaintext::Plaintext)Get the degree of the scaling factor for the given ciphertext or plaintext..
See also: Ciphertext, Plaintext, SetNoiseScaleDeg
OpenFHE.GetPackedValue — Function
OpenFHE.GetPlaintextBigModulus — Function
GetPlaintextBigModulus(parameters::EncodingParams)Return the big plaintext modulus used by the given parameters.
See also: EncodingParams, SetPlaintextBigModulus
OpenFHE.GetPlaintextBigRootOfUnity — Function
GetPlaintextBigRootOfUnity(parameters::EncodingParams)Return the big plaintext modulus root of unity used by the given parameters.
See also: EncodingParams, SetPlaintextBigRootOfUnity
OpenFHE.GetPlaintextGenerator — Function
GetPlaintextGenerator(parameters::EncodingParams)::UInt32Return the plaintext generator used by the given parameters.
See also: EncodingParams, SetPlaintextGenerator
OpenFHE.GetPlaintextModulus — Function
GetPlaintextModulus(parameters::EncodingParams)Return the plaintext modulus used by the given parameters.
See also: EncodingParams, SetPlaintextModulus
OpenFHE.GetPlaintextRootOfUnity — Function
GetPlaintextRootOfUnity(parameters::EncodingParams)Return the plaintext modulus root of unity used by the given parameters.
See also: EncodingParams, SetPlaintextRootOfUnity
OpenFHE.GetRealPackedValue — Function
OpenFHE.GetRingDimension — Function
GetRingDimension(crypto_context::CryptoContext)::UInt32Return the polynomial ring dimension for a given crypto_context.
See also: CryptoContext
OpenFHE.GetRootOfUnity — Function
GetRootOfUnity(crypto_context::CryptoContext)::UInt32Return the root of unity used for a given crypto_context.
See also: CryptoContext
OpenFHE.GetScalingFactor — Function
GetScalingFactor(ciphertext::Ciphertext)
GetScalingFactor(plaintext::Plaintext)Return the scaling factor for the given ciphertext or plaintext.
See also: Ciphertext, Plaintext, SetScalingFactor
OpenFHE.GetSlots — Function
GetSlots(ciphertext::Ciphertext)
GetSlots(plaintext::Plaintext)Return the number of slots for the given ciphertext or plaintext.
See also: Ciphertext, Plaintext, SetSlots
OpenFHE.GetStringValue — Function
OpenFHE.IsEncoded — Function
OpenFHE.KeyGen — Function
KeyGen(crypto_context::CryptoContext)Generate and return a key pair with a public and a private key for a given crypto_context.
See also: CryptoContext, KeyPair, PublicKey, PrivateKey
OpenFHE.MakeCKKSPackedPlaintext — Method
MakeCKKSPackedPlaintext(crypto_context::CryptoContext, value::Vector{Float64};
scale_degree = 1,
level = 1,
params = C_NULL,
num_slots = 0)Encode a vector of real numbers value into a CKKS-packed Plaintext using the given crypto_context. Please refer to the OpenFHE documentation for details on the remaining arguments.
See also: CryptoContext, Plaintext
OpenFHE.MakePackedPlaintext — Method
MakePackedPlaintext(crypto_context::CryptoContext, value::Vector{<:Integer};
noise_scale_degree = 1,
level = 0)Encode a vector of integers value into a BFV/BGV-packed Plaintext using the given crypto_context. Please refer to the OpenFHE documentation for details on the remaining arguments.
See also: CryptoContext, Plaintext
OpenFHE.ModReduce — Function
ModReduce(crypto_context::CryptoContext, ciphertext::Ciphertext)Scale down to the original scale of the ciphertext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, Rescale, ModReduceInPlace
OpenFHE.ModReduceInPlace — Function
ModReduceInPlace(crypto_context::CryptoContext, ciphertext::Ciphertext)Scale down to the original scale of the ciphertext in-place. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, RescaleInPlace, ModReduce
OpenFHE.ReleaseAllContexts — Function
ReleaseAllContexts()Clear all generated CryptoContexts from CryptoContextFactory.
See also: CryptoContext
OpenFHE.Relinearize — Function
Relinearize(crypto_context::CryptoContext, ciphertext::Ciphertext)Perform relinearization of the ciphertext to the lowest level (with 2 polynomials per ciphertext) and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, RelinearizeInPlace
OpenFHE.RelinearizeInPlace — Function
RelinearizeInPlace(crypto_context::CryptoContext, ciphertext::Ciphertext)Perform in-place relinearization of the ciphertext to the lowest level (with 2 polynomials per ciphertext). The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, Relinearize
OpenFHE.Rescale — Function
Rescale(crypto_context::CryptoContext, ciphertext::Ciphertext)An alias for ModReduce method. ModReduce is called Rescale in CKKS.
Scale down to the original scale of the ciphertext and return the resulting Ciphertext. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, ModReduce, RescaleInPlace
OpenFHE.RescaleInPlace — Function
RescaleInPlace(crypto_context::CryptoContext, ciphertext::Ciphertext)An alias for ModReduceInPlace method. ModReduceInPlace is called RescaleInPlace in CKKS.
Scale down to the original scale of the ciphertext in-place. The input ciphertext needs to be derived from the given crypto_context.
See also: CryptoContext, Ciphertext, ModReduceInPlace, Rescale
OpenFHE.SetBatchSize — Function
SetBatchSize(parameters::EncodingParams, batch_size::Integer)Set the plaintext batch size for the given parameters.
See also: EncodingParams, GetBatchSize
OpenFHE.SetFirstModSize — Function
SetFirstModSize(parameters::CCParams, modulus::Integer)Set the first modulus for a set of parameters.
See also: SetScalingModSize
OpenFHE.SetHopLevel — Function
SetHopLevel(ciphertext::Ciphertext, level::Integer)Set the re-encryption level for the given ciphertext.
See also: Ciphertext, GetHopLevel
OpenFHE.SetKeyGenLevel — Function
SetKeyGenLevel(crypto_context::CryptoContext, level::Integer)For future use: Set level at which evaluation keys should be generated for the given crypto_context.
See also: CryptoContext, GetKeyGenLevel
OpenFHE.SetKeySwitchTechnique — Function
SetKeySwitchTechnique(parameters::CCParams, technique::KeySwitchTechnique)Set the key switching technique technique for a set of parameters.
See also: KeySwitchTechnique
OpenFHE.SetLevel — Function
SetLevel(ciphertext::Ciphertext, level::Integer)
SetLevel(plaintext::Plaintext, level::Integer)Set the number of scalings level for the given ciphertext or plaintext..
See also: Ciphertext, Plaintext, GetLevel
OpenFHE.SetMultiplicativeDepth — Function
SetMultiplicativeDepth(parameters::CCParams, depth::Integer)Set the required multiplicative depth for a set of parameters.
OpenFHE.SetNoiseScaleDeg — Function
SetNoiseScaleDeg(ciphertext::Ciphertext, degree::Integer)
SetNoiseScaleDeg(plaintext::Plaintext, degree::Integer)Set the degree of the scaling factor for the given ciphertext or plaintext..
See also: Ciphertext, Plaintext, GetNoiseScaleDeg
OpenFHE.SetNumLargeDigits — Function
SetNumLargeDigits(parameters::CCParams, number::Integer)Set the number of large digits for a set of parameters.
OpenFHE.SetPlaintextBigModulus — Function
SetPlaintextBigModulus(parameters::EncodingParams, plaintext_big_modulus::Integer)Set the big plaintext modulus for the given parameters.
See also: EncodingParams, GetPlaintextBigModulus
OpenFHE.SetPlaintextBigRootOfUnity — Function
SetPlaintextBigRootOfUnity(parameters::EncodingParams, plaintext_big_root_of_unity::Integer)Set the big plaintext modulus root of unity for the given parameters.
See also: EncodingParams, GetPlaintextBigRootOfUnity
OpenFHE.SetPlaintextGenerator — Function
SetPlaintextGenerator(parameters::EncodingParams, plaintext_generator::Integer)Set the plaintext generator for the given parameters.
See also: EncodingParams, GetPlaintextGenerator
OpenFHE.SetPlaintextModulus — Function
SetPlaintextModulus(parameters::EncodingParams, plaintext_modulus::Integer)Set the plaintext modulus for the given parameters.
See also: EncodingParams, GetPlaintextModulus
OpenFHE.SetPlaintextRootOfUnity — Function
SetPlaintextRootOfUnity(parameters::EncodingParams, plaintext_root_of_unity::Integer)Set the plaintext modulus root of unity for the given parameters.
See also: EncodingParams, GetPlaintextRootOfUnity
OpenFHE.SetRingDim — Function
SetRingDim(parameters::CCParams, dimension::Integer)Set the polynomial ring dimension for a set of parameters.
OpenFHE.SetScalingFactor — Function
SetScalingFactor(ciphertext::Ciphertext, factor::Real)
SetScalingFactor(plaintext::Plaintext, factor::Real)Set the scaling factor for the given ciphertext or plaintext.
See also: Ciphertext, Plaintext, GetScalingFactor
OpenFHE.SetScalingModSize — Function
SetScalingModSize(parameters::CCParams, modulus::Integer)Set the scaling modulus for a set of parameters.
See also: SetFirstModSize
OpenFHE.SetScalingTechnique — Function
SetScalingTechnique(parameters::CCParams, technique::ScalingTechnique)Set the ciphertext multiplication technique for a set of parameters.
See also: ScalingTechnique
OpenFHE.SetSecretKeyDist — Function
SetSecretKeyDist(parameters::CCParams, distribution::SecretKeyDist)Set the distribution from which the secret key is chosen for a set of parameters.
See also: SecretKeyDist
OpenFHE.SetSecurityLevel — Function
SetSecurityLevel(parameters::CCParams, level::SecurityLevel)Set the encryption security level according to the homomogrphic encryption standard for a set of parameters.
See also: SecurityLevel
OpenFHE.SetSlots — Function
SetSlots(ciphertext::Ciphertext, slots::Integer)
SetSlots(plaintext::Plaintext, slots::Integer)Set the number of slots for the given ciphertext or plaintext.
See also: Ciphertext, Plaintext, GetSlots
OpenFHE.get_native_int — Function
OpenFHE.get_native_int()Return the native integer size for an OpenFHE-julia installation, it can be 64 or 128 bits.
See also: OpenFHE.set_native_int!
OpenFHE.library_path — Method
OpenFHE.private_key — Function
OpenFHE.private_key(key_pair::KeyPair)Return the private key from a key_pair.
See also: KeyPair, public_key
OpenFHE.public_key — Function
OpenFHE.public_key(key_pair::KeyPair)Return the public key from a key_pair.
See also: KeyPair, private_key
OpenFHE.set_library! — Function
OpenFHE.set_library!(path = nothing; force = true)Set the absolute path to a system-provided OpenFHE-julia installation, e.g., something like /path/to/libopenfhe_julia.<ext>, where <ext> is so on Linux,dylibon macOS, anddllon Windows. Restart the Julia session after executing this function such that the changes take effect. Usingnothing` as the path will revert the library path to the default settings, i.e., the JLL-provided version of OpenFHE-julia will be used.
OpenFHE.set_native_int! — Function
OpenFHE.set_native_int!(native_int::Integer = 64)Set the native integer size for an OpenFHE-julia installation, it can be 64 or 128 bits. Restart the Julia session after executing this function such that the changes take effect.
See also: OpenFHE.get_native_int