The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

openfhe.R

CRAN status R-CMD-check CRAN downloads

This is an interface to the Fully Homomorphic Encryption library developed by OpenFHE.

The companion package homomorpheR (version >= 1.0) imports this package and includes a number of illustrative vignettes. Specifically, the examples demonstrate how to use existing R functions and optimizers to implement a homomorphic-encryption protocol across multiple sites.

Citing

Both packages are described in

Narasimhan, B. (2026). Fully Homomorphic Encryption for Statistical Modeling. arXiv:2610.04163 [stat.CO]. https://arxiv.org/abs/2610.04163

citation("openfhe.R") gives the BibTeX entries for the paper, the package, and the underlying OpenFHE library.

Schemes

All four FHE subsystems (BFV, BGV, CKKS, BinFHE) are exposed. In addition, we provide facilities for serialization, threshold FHE, CKKS bootstrapping, transcendental function evaluation, and CKKS hoisted (fast) rotations.

Quick Start

library(openfhe.R)

# BFV: exact integer arithmetic
cc <- fhe_context("BFV", plaintext_modulus = 65537, multiplicative_depth = 2)
keys <- key_gen(cc, eval_mult = TRUE)

ct1 <- encrypt(keys@public, make_packed_plaintext(cc, 1:8), cc = cc)
ct2 <- encrypt(keys@public, make_packed_plaintext(cc, 10:17), cc = cc)

# Compute on encrypted data
result <- decrypt(ct1 + ct2, keys@secret, cc = cc)
get_packed_value(result)[1:8]
#> [1] 11 13 15 17 19 21 23 25

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.