API reference

Base.circshiftMethod
circshift(sa::SecureArray, shifts)

Circularly shift, i.e., rotate the data in sa by shifts positions, similarly to Julia's circshift for regular arrays.

Note: If N is greater than one, this operation increases the multiplicative level by two, otherwise by one.

Note: To precompute all required rotation indexes, use init_rotation!.

See also: SecureArray, init_rotation!

source
SecureArithmetic.bootstrap!Function
bootstrap!(secure_array::SecureArray{<:OpenFHEBackend}, num_iterations = 1,
           precision = 0)

Refresh a given secure_array to increase the multiplication depth. Supported for CKKS only. Please refer to the OpenFHE documentation for details on the arguments num_iterations and precision.

See also: SecureArray, OpenFHEBackend, init_bootstrapping!

source
SecureArithmetic.enable_multithreadingFunction
enable_multithreading(enabled=true)

Enable multithreaded execution when enabled is set to true. To disable multithreading, use disable_multithreading.

This multithreading capability takes place entirely on the Julia side and parallelizes operations over multiple ciphertexts within a single SecureArray. That is, it will have no effect if only one ciphertext is sufficient to hold all data. Please be aware that mixing Julia's multithreading with OpenFHE's builtin OpenMP-based multithreading might cause troubles. Thus if in doubt, set the environment variable OMP_NUM_THREADS=1 to avoid potential issues.

Note: By default multithreading is disabled.

See also: disable_multithreading

source
SecureArithmetic.init_rotation!Method
init_rotation!(context::SecureContext{<:OpenFHEBackend}, private_key::PrivateKey,
               shape::Union{Integer, NTuple{N, Integer}}, shifts...)

Generate all required rotation keys for applying shifts with circshift for arrays of the given shape using the private_key. The keys are stored in the given context.

See also: SecureContext, OpenFHEBackend, PrivateKey

source
SecureArithmetic.levelMethod
level(a::Union{SecureArray{<:Unencrypted}, PlainArray{<:Unencrypted}})

Return the number of scalings, referred to as the level, performed over a. For data type derived from Unencrypted, the level is always equal to 0.

See also: PlainArray, SecureArray

source
SecureArithmetic.release_context_memoryMethod
release_context_memory()

Release all OpenFHE.CryptoContexts and keys for multiplication, rotation, bootstrapping and OpenFHE.EvalSum generated in the functions init_multiplication!, init_rotation!, init_bootstrapping! and OpenFHE.EvalSumKeyGen.

In the source code of OpenFHE C++, all CryptoContexts and keys are stored in static objects. Without using release_context_memory, the memory allocated for these contexts and keys will only be freed after restarting the Julia REPL. It is also advisable to call GC.gc() after a call to release_context_memory to clean up all memory on the Julia side.

See also: init_multiplication!, init_rotation!, init_bootstrapping!

source