Package: openfhe 1.5.1

openfhe: R Interface to the OpenFHE Fully Homomorphic Encryption Library

Provides an R interface to the OpenFHE C++ library for fully homomorphic encryption (FHE). Supports BFV, BGV, and CKKS schemes for computation on encrypted data, as well as FHEW/TFHE for Boolean circuit evaluation.

Authors:Balasubramanian Narasimhan [aut, cre], Authors of the OpenFHE C++ library [ctb, cph]

openfhe_1.5.1.tar.gz
openfhe_1.5.1.zip(r-4.7)openfhe_1.5.1.zip(r-4.6)openfhe_1.5.1.zip(r-4.5)
openfhe_1.5.1.tgz(r-4.6-x86_64)openfhe_1.5.1.tgz(r-4.6-arm64)openfhe_1.5.1.tgz(r-4.5-x86_64)openfhe_1.5.1.tgz(r-4.5-arm64)
openfhe_1.5.1.tar.gz(r-4.7-arm64)openfhe_1.5.1.tar.gz(r-4.7-x86_64)openfhe_1.5.1.tar.gz(r-4.6-arm64)openfhe_1.5.1.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
card.svg |card.png
openfhe/json (API)
NEWS

# Install 'openfhe' in R:
install.packages('openfhe', repos = c('https://bnaras.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/bnaras/fhe/issues

Pkgdown/docs site:https://bnaras.github.io

Uses libs:
  • c++โ€“ GNU Standard C++ Library v3
  • openmpโ€“ GCC OpenMP (GOMP) support library

On CRAN:

Conda:

cppopenmp

4.34 score 49 scripts 235 exports 3 dependencies

Last updated from:c960bff486. Checks:12 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK566
linux-devel-x86_64OK615
source / vignettesOK1120
linux-release-arm64OK626
linux-release-x86_64OK611
macos-release-arm64OK539
macos-release-x86_64OK1062
macos-oldrel-arm64OK755
macos-oldrel-x86_64OK1106
windows-develOK989
windows-releaseOK1042
windows-oldrelOK986
wasm-releaseFAIL105

Exports:BFVParamsBGVParamsbin_bt_key_genbin_decryptbin_encryptbin_fhe_contextbin_key_genBinFHEMethodBinFHEOutputBinFHEParamSetBinGateCiphertextckks_scaling_factor_bitsCKKSDataTypeCKKSParamsclear_eval_automorphism_keysclear_eval_mult_keysclear_fhe_stateclear_static_maps_and_vectorscompressCompressionLevelCryptoContextCryptoParametersdecryptDecryptionNoiseModedeserialize_eval_keysDistributionTypeElementParamsenable_featureEncodingParamsencryptEncryptionTechniqueeval_addeval_add_in_placeeval_add_mutableeval_at_index_key_geneval_automorphismeval_automorphism_key_geneval_bin_gateeval_bootstrapeval_bootstrap_key_geneval_bootstrap_setupeval_chebysheveval_chebyshev_coefficientseval_chebyshev_functioneval_chebyshev_lineareval_chebyshev_pseval_coseval_divideeval_fast_rotationeval_fast_rotation_exteval_fast_rotation_precomputeeval_flooreval_funceval_logisticeval_multeval_mult_and_relinearizeeval_mult_in_placeeval_mult_key_geneval_mult_mutableeval_mult_no_relineval_negateeval_negate_in_placeeval_noteval_polyeval_poly_lineareval_poly_pseval_rotateeval_rotate_key_geneval_signeval_sineval_squareeval_square_mutableeval_subeval_sub_in_placeeval_sub_mutableeval_sumeval_sum_key_genEvalKeyEvalKeyMapExecutionModeFastRotationPrecomputationFeaturefhe_ckks_tolerancefhe_contextfhe_deserializefhe_serializefind_automorphism_indexfind_automorphism_indicesgenerate_lut_via_functionget_all_eval_automorphism_keysget_all_eval_mult_keysget_all_eval_sum_keysget_batch_sizeget_bootstrap_depthget_ckks_boot_correction_factorget_ckks_data_typeget_coef_packed_valueget_complex_packed_valueget_composite_degreeget_crypto_contextget_crypto_parametersget_cyclotomic_orderget_decryption_noise_modeget_desired_precisionget_digit_sizeget_element_paramsget_element_ring_dimensionget_encoding_paramsget_encoding_typeget_encryption_techniqueget_eval_add_countget_eval_automorphism_key_mapget_eval_mult_key_vectorget_eval_sum_key_mapget_execution_modeget_first_mod_sizeget_formatted_valuesget_interactive_boot_compression_levelget_key_gen_levelget_key_switch_countget_key_switch_techniqueget_key_tagget_lengthget_levelget_log_errorget_log_precisionget_max_plaintext_spaceget_max_relin_sk_degget_multiparty_modeget_multiplication_techniqueget_multiplicative_depthget_native_intget_noise_estimateget_noise_scale_degget_num_adversarial_queriesget_num_large_digitsget_packed_valueget_plaintext_modulusget_pre_modeget_pre_num_hopsget_real_packed_valueget_register_word_sizeget_ring_dimget_scaling_factorget_scaling_factor_intget_scaling_factor_realget_scaling_mod_sizeget_scaling_techniqueget_schemeget_scheme_idget_secret_key_distget_security_levelget_slotsget_standard_deviationget_statistical_securityget_string_valueget_threshold_num_of_partieshigh_boundinsert_eval_automorphism_keyinsert_eval_mult_keyinsert_eval_sum_keyint_boot_addint_boot_adjust_scaleint_boot_decryptint_boot_encryptint_mp_boot_addint_mp_boot_adjust_scaleint_mp_boot_decryptint_mp_boot_encryptint_mp_boot_random_element_genis_encodedis_goodkey_genkey_switch_downKeygenModeKeyPairKeySwitchTechniquelevel_reducelevel_reduce_in_placelow_boundLWECiphertextLWEPrivateKeymake_ckks_packed_plaintextmake_coef_packed_plaintextmake_packed_plaintextmod_reducemod_reduce_in_placemulti_add_eval_automorphism_keysmulti_add_eval_keysmulti_add_eval_mult_keysmulti_add_eval_sum_keysmulti_add_pub_keysmulti_eval_at_index_key_genmulti_eval_automorphism_key_genmulti_eval_sum_key_genmulti_key_switch_genmultiparty_decrypt_fusionmultiparty_decrypt_leadmultiparty_decrypt_mainmultiparty_key_genMultipartyModeMultiplicationTechniqueOpenFHEObjectPlaintextplaintext_params_hashPlaintextEncodingsPREModePrivateKeyPublicKeyrecover_shared_keyrelinearizerescalering_dimensionScalingTechniqueSchemeIdSecretKeyDistSecretShareMapSecurityLevelserialize_eval_keysset_ckks_boot_correction_factorset_ckks_data_typeset_int_vector_valueset_key_gen_levelset_key_tagset_lengthset_levelset_noise_scale_degset_scaling_factorset_scaling_factor_intset_slotsset_string_valueshare_keysthreshold_decryptwith_fhe_context

Dependencies:clicpp11S7

BinFHE: Boolean Circuits and Arbitrary Functions on Encrypted Bits

Rendered frombinfhe-boolean-circuits.Rmdusingknitr::rmarkdownon Jun 13 2026.

Last update: 2026-06-13
Started: 2026-06-13

CKKS Bootstrapping: Refreshing Deep Circuits

Rendered fromckks-bootstrapping.Rmdusingknitr::rmarkdownon Jun 13 2026.

Last update: 2026-06-13
Started: 2026-06-13

Introduction to openfhe: Fully Homomorphic Encryption in R

Rendered fromintroduction.Rmdusingknitr::rmarkdownon Jun 13 2026.

Last update: 2026-06-13
Started: 2026-04-17

Readme and manuals

Help Manual

Help pageTopics
openfhe: R Interface to the OpenFHE Fully Homomorphic Encryption Libraryopenfhe-package openfhe
BFV ParametersBFVParams
BGV ParametersBGVParams
Generate BinFHE bootstrapping keysbin_bt_key_gen
Decrypt a Binary FHE ciphertextbin_decrypt
Encrypt a value for Binary FHEbin_encrypt
Create a Binary FHE contextbin_fhe_context
Generate BinFHE secret keybin_key_gen
Binary FHE Methods Source: binfhe/binfhe-constants.h enum BINFHE_METHODBinFHEMethod
Binary FHE Output Types Source: binfhe/binfhe-constants.h enum BINFHE_OUTPUTBinFHEOutput
Binary FHE Parameter Sets Source: binfhe/binfhe-constants.h enum BINFHE_PARAMSET (sequential from 0)BinFHEParamSet
Binary Gate Types Source: binfhe/binfhe-constants.h enum BINGATE (sequential from 0)BinGate
CCParams getters (all schemes)ccparams_getters get_batch_size get_ckks_data_type get_composite_degree get_decryption_noise_mode get_desired_precision get_digit_size get_encryption_technique get_eval_add_count get_execution_mode get_first_mod_size get_interactive_boot_compression_level get_key_switch_count get_key_switch_technique get_max_relin_sk_deg get_multiparty_mode get_multiplication_technique get_multiplicative_depth get_noise_estimate get_num_adversarial_queries get_num_large_digits get_plaintext_modulus get_pre_mode get_pre_num_hops get_register_word_size get_ring_dim get_scaling_mod_size get_scaling_technique get_scheme get_secret_key_dist get_security_level get_standard_deviation get_statistical_security get_threshold_num_of_parties
Ciphertext classCiphertext
CKKS scaling-mod-size in bitsckks_scaling_factor_bits
CKKS Data Type Source: pke/constants-defs.h enum CKKSDataTypeCKKSDataType
CKKS ParametersCKKSParams
Clear the EvalAutomorphism key cacheclear_eval_automorphism_keys
Clear the EvalMult key cacheclear_eval_mult_keys
Clear cached evaluation keys and contextsclear_fhe_state
Clear OpenFHE static maps and vectorsclear_static_maps_and_vectors
Compress a ciphertext to fewer towerscompress
Compression Level (interactive multi-party bootstrap) Source: pke/constants-defs.h enum CompressionLevel NOTE: values start at 2, not 0. The header comment explains that compression levels 0 and 1 are not supported and the values are not renumbered.CompressionLevel
Crypto ContextCryptoContext
Crypto Parameters (opaque)CryptoParameters
Decrypt a ciphertextdecrypt
Decryption Noise Mode Source: pke/constants-defs.h enum DecryptionNoiseModeDecryptionNoiseMode
Deserialize evaluation keys from filedeserialize_eval_keys
Distribution Type (lattice parameters) Source: core/lattice/stdlatticeparms.h enum DistributionTypeDistributionType
Element Parameters (opaque)ElementParams
Enable a feature on a CryptoContextenable_feature
Encoding Parameters (opaque)EncodingParams
Encrypt a plaintextencrypt
Encryption Technique Source: pke/constants-defs.h enum EncryptionTechniqueEncryptionTechnique
Homomorphic additioneval_add
Homomorphic addition in placeeval_add_in_place
Homomorphic add, mutable varianteval_add_mutable
Generate at-index (rotation) keys for a secret keyeval_at_index_key_gen
Apply an automorphism to a ciphertexteval_automorphism
Generate automorphism evaluation keys for a set of indiceseval_automorphism_key_gen
Evaluate a binary gate on encrypted valueseval_bin_gate
Perform CKKS bootstrappingeval_bootstrap
Generate bootstrapping keyseval_bootstrap_key_gen
Set up CKKS bootstrappingeval_bootstrap_setup
Evaluate a Chebyshev series on a ciphertexteval_chebyshev
Chebyshev coefficients for a real-valued functioneval_chebyshev_coefficients
Evaluate a user-supplied function on a CKKS ciphertext via Chebyshev approximationeval_chebyshev_function
Evaluate a Chebyshev series via the linear evaluatoreval_chebyshev_linear
Evaluate a Chebyshev series via the Paterson-Stockmeyer methodeval_chebyshev_ps
Evaluate cosine on a ciphertexteval_cos
Evaluate division approximation on a ciphertexteval_divide
Hoisted slot rotation using precomputed digitseval_fast_rotation
Extended hoisted slot rotationeval_fast_rotation_ext
Precompute digit decomposition for hoisted fast rotationseval_fast_rotation_precompute
Evaluate a floor (rounding) function on an LWE ciphertexteval_floor
Evaluate an arbitrary function on an encrypted valueeval_func
Evaluate logistic function on a ciphertexteval_logistic
Homomorphic multiplicationeval_mult
Fused multiply-and-relinearizeeval_mult_and_relinearize
Homomorphic multiplication in placeeval_mult_in_place
Generate relinearization (eval-mult) keys for a secret keyeval_mult_key_gen
Homomorphic multiply, mutable varianteval_mult_mutable
Homomorphic multiplication without relinearizationeval_mult_no_relin
Homomorphic negationeval_negate
Homomorphic negation in placeeval_negate_in_place
Evaluate NOT on an encrypted valueeval_not
Evaluate a polynomial on a ciphertexteval_poly
Evaluate a polynomial via the linear evaluatoreval_poly_linear
Evaluate a polynomial via the Paterson-Stockmeyer methodeval_poly_ps
Rotate ciphertext slotseval_rotate
Generate rotation keys for a secret keyeval_rotate_key_gen
Evaluate sign on an encrypted value (functional bootstrapping)eval_sign
Evaluate sine on a ciphertext (Chebyshev approximation)eval_sin
Homomorphic squaringeval_square
Homomorphic square, mutable varianteval_square_mutable
Homomorphic subtractioneval_sub
Homomorphic subtraction in placeeval_sub_in_place
Homomorphic subtract, mutable varianteval_sub_mutable
Sum all slots in a ciphertexteval_sum
Generate sum keys for a secret keyeval_sum_key_gen
EvalKey class for multi-party key operationsEvalKey
Map of homomorphic evaluation keysEvalKeyMap
Execution Mode Source: pke/constants-defs.h enum ExecutionModeExecutionMode
Precomputed digit decomposition for hoisted rotationsFastRotationPrecomputation
PKE Scheme Features (bitmask) Source: pke/constants-defs.h enum PKESchemeFeatureFeature
Per-test CKKS precision tolerancefhe_ckks_tolerance
Create a fully homomorphic encryption contextfhe_context
Deserialize an OpenFHE object from filefhe_deserialize
Serialize an OpenFHE object to filefhe_serialize
Compute the automorphism index for a single slot indexfind_automorphism_index
Compute the automorphism indices for a list of slot indicesfind_automorphism_indices
Generate a lookup table for an arbitrary plaintext functiongenerate_lut_via_function
Retrieve all registered EvalAutomorphism key mapsget_all_eval_automorphism_keys
Retrieve all registered EvalMult key vectorsget_all_eval_mult_keys
Retrieve all registered EvalSum key mapsget_all_eval_sum_keys
Get the required multiplicative depth for CKKS bootstrappingget_bootstrap_depth
Get the CKKS bootstrap correction factorget_ckks_boot_correction_factor
Get complex values from a CKKS plaintextget_complex_packed_value
Associated CryptoContext of a Ciphertextget_crypto_context
Crypto parameters of a CryptoContextget_crypto_parameters
Cyclotomic order of a CryptoContextget_cyclotomic_order
Element parameters of a CryptoContextget_element_params
Encoding parameters of a CryptoContextget_encoding_params
Retrieve the automorphism-key map for a given key tagget_eval_automorphism_key_map
Retrieve the EvalMult key vector for a given key tagget_eval_mult_key_vector
Retrieve the sum-key map for a given key tagget_eval_sum_key_map
Key-generation level of a CryptoContextget_key_gen_level
Maximum supported plaintext space for functional bootstrappingget_max_plaintext_space
Get the native integer size of the OpenFHE buildget_native_int
Get packed integer values from a plaintextget_packed_value
Get real values from a CKKS plaintextget_real_packed_value
Real-valued CKKS scaling factor at a modulus-chain levelget_scaling_factor_real
Insert a joined automorphism-key map into the cc registryinsert_eval_automorphism_key
Insert an EvalMult key vector into the cc registryinsert_eval_mult_key
Insert a joined sum-key map into the cc registryinsert_eval_sum_key
Combine encrypted and unencrypted masked decryptionsint_boot_add
Prepare a ciphertext for interactive bootstrapint_boot_adjust_scale
Server-side masked decryption for interactive bootstrapint_boot_decrypt
Client-side re-encryption for interactive bootstrapint_boot_encrypt
Aggregate multi-party shares pairsint_mp_boot_add
Prepare a ciphertext for multi-party interactive bootstrapint_mp_boot_adjust_scale
Multi-party masked decryption for interactive bootstrapint_mp_boot_decrypt
Final re-encryption for multi-party interactive bootstrapint_mp_boot_encrypt
Generate a common random element for multi-party bootstrapint_mp_boot_random_element_gen
Is a KeyPair valid?is_good
Generate key pairkey_gen
Scale a ciphertext down from extended CRT basis to Qkey_switch_down
Key tag accessorsget_key_tag key_tag set_key_tag
Key Generation Mode Source: binfhe/binfhe-constants.h enum KEYGEN_MODEKeygenMode
Key PairKeyPair
Key Switching Techniques Source: pke/constants-defs.h enum KeySwitchTechniqueKeySwitchTechnique
Reduce the modulus chain by multiple levelslevel_reduce
Reduce the modulus chain by multiple levels, in placelevel_reduce_in_place
LWE Ciphertext (Binary FHE)LWECiphertext
LWE Private Key (Binary FHE)LWEPrivateKey
Make a CKKS packed plaintext from real numbersmake_ckks_packed_plaintext
Make a coefficient-packed integer plaintextmake_coef_packed_plaintext
Make a packed integer plaintextmake_packed_plaintext
Reduce the modulus chain by one levelmod_reduce
Reduce the modulus chain by one level, in placemod_reduce_in_place
Combine two automorphism-key map sharesmulti_add_eval_automorphism_keys
Combine evaluation keys from multiple partiesmulti_add_eval_keys
Combine partial eval-mult keys from multiple partiesmulti_add_eval_mult_keys
Combine two sum-key map shares into a joint sum-key mapmulti_add_eval_sum_keys
Combine public keys from multiple partiesmulti_add_pub_keys
Generate a joint rotation-at-index key sharemulti_eval_at_index_key_gen
Generate a joint automorphism-key share for multi-party rotationmulti_eval_automorphism_key_gen
Generate a joint sum-key share for multi-party EvalSummulti_eval_sum_key_gen
Multi-party key-switch eval-key generationmulti_key_switch_gen
Fuse partial decryptions into final plaintextmultiparty_decrypt_fusion
Lead party's partial decryptionmultiparty_decrypt_lead
Non-lead party's partial decryptionmultiparty_decrypt_main
Generate a key pair for a secondary party in threshold FHEmultiparty_key_gen
Multiparty Mode Source: pke/constants-defs.h enum MultipartyModeMultipartyMode
Multiplication Technique (BFV) Source: pke/constants-defs.h enum MultiplicationTechniqueMultiplicationTechnique
Base class for OpenFHE objectsOpenFHEObject
PlaintextPlaintext
Plaintext accessorsget_coef_packed_value get_element_ring_dimension get_encoding_type get_formatted_values get_length get_level get_log_error get_log_precision get_noise_scale_deg get_scaling_factor get_scaling_factor_int get_scheme_id get_slots get_string_value high_bound is_encoded low_bound plaintext_accessors set_ckks_data_type set_int_vector_value set_level set_noise_scale_deg set_scaling_factor set_scaling_factor_int set_slots set_string_value
Deterministic hash of a plaintext's identifying parametersplaintext_params_hash
Plaintext Encoding Types Source: pke/constants-defs.h enum PlaintextEncodingsPlaintextEncodings
Proxy Re-encryption Mode Source: pke/constants-defs.h enum ProxyReEncryptionMode R-side name 'PREMode' matches the design.md ยง8 shortening convention (same pattern as 'Feature' for 'PKESchemeFeature').PREMode
Private KeyPrivateKey
Public KeyPublicKey
Recover a secret key from distributed sharesrecover_shared_key
Relinearize a higher-degree ciphertextrelinearize
Rescale a CKKS ciphertext (alias for ModReduce)rescale
Ring dimension of a CryptoContextring_dimension
Scaling Techniques (CKKS) Source: pke/constants-defs.h enum ScalingTechniqueScalingTechnique
Scheme IdentifierSchemeId
Secret Key Distribution Source: core/lattice/constants-lattice.h enum SecretKeyDistSecretKeyDist
Map of secret-key shares for threshold-FHE abort recoverySecretShareMap
Security Levels Source: core/lattice/stdlatticeparms.h enum SecurityLevelSecurityLevel
Serialize evaluation keys to fileserialize_eval_keys
Set the CKKS bootstrap correction factorset_ckks_boot_correction_factor
Set the key-generation level of a CryptoContextset_key_gen_level
Set the effective length of a plaintextset_length
Distribute a secret key into sharesshare_keys
Threshold decryption convenience: lead + main + fusion in one callthreshold_decrypt
Execute code with automatic cleanup of FHE statewith_fhe_context