Package: homomorpheR 1.0

Balasubramanian Narasimhan

homomorpheR: Homomorphic Computations in R

Privacy-preserving statistics across sites that never share their data, using fully homomorphic encryption through the 'openfhe.R' interface to OpenFHE (CKKS, BFV, BGV), with n-of-n threshold key generation so that no single party can decrypt. Ships master/worker primitives that let ordinary R modeling code run across sites, and a frozen implementation of the Paillier additive scheme kept for backward compatibility. The protocols are described in Narasimhan (2026) <doi:10.48550/arXiv.2610.04163>.

Authors:Balasubramanian Narasimhan [aut, cre, cph]

homomorpheR_1.0.tar.gz
homomorpheR_1.0.zip(r-4.7-any)homomorpheR_1.0.zip(r-4.6-any)homomorpheR_1.0.zip(r-4.5-any)
homomorpheR_1.0.tgz(r-4.6-any)homomorpheR_1.0.tgz(r-4.5-any)
homomorpheR_1.0.tar.gz(r-4.7-any)homomorpheR_1.0.tar.gz(r-4.6-any)
homomorpheR_1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
homomorpheR/json (API)

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

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

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

Datasets:

On CRAN:

Conda:

7.36 score 5 stars 54 scripts 580 downloads 42 exports 7 dependencies

Last updated from:32ca485121. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK131
source / vignettesOK221
linux-releaseOK132
macos-releaseOK89
macos-oldrelOK128
windows-develOK89
windows-releaseOK94
windows-oldrelOK86
wasm-releaseOK110

Exports:add_local_and_forwardadd_siteCKKSMastercontributedecryptencryptencrypt_realget_lambdaget_private_keykeygen_roundLocalSitemake_ckks_mastermake_mastermake_ncpartymake_threshold_mastermake_workerMastermaster_aggregateNCPartyOpenFHEParamspaillier_keypairPaillierCiphertextPaillierEncryptedRealPaillierKeyPairPaillierMasterPaillierParamsPaillierPrivateKeyPaillierPublicKeypartial_decryptPublicParamsrandom.bigzRemoteSiteround_robin_chainrun_round_robinset_next_siteset_public_keyset_public_paramsset_workersSitesite_paramssite_unavailableThresholdMaster

Dependencies:clicpp11gmpopenfhe.RrlangS7sodium

Federated Cox-Lasso via Consensus ADMM on DLBCL
Introduction | The global problem and its consensus split | The federated fit in the clear | The same fit under threshold FHE | Comparison with the centralized fit | What the protocol hides and reveals | Discussion | Limitations

Last update: 2026-10-02
Started: 2026-06-12

Distributed Maximum Likelihood Estimation
The statistical problem | The privacy constraint | The protocol | Implementation | 1. Generate a CKKS key pair | 2. Build workers and master | 3. Run mle() through the encrypted channel | Beyond MLE | CAVEAT

Last update: 2026-10-01
Started: 2026-04-26

Distributed Stratified Cox Regression
The statistical problem | DLBCL lymphoma cohort | The aggregated fit | The protocol | Wiring up the protocol | Iterative MLE through the encrypted protocol | Comparison with the cleartext fit | What just happened | What this demonstrates | Caveats and extensions

Last update: 2026-10-01
Started: 2026-04-26

Federated Cosine Similarity with Site-Private Fine-Tuned Models
Introduction | The setup | Threat model | The protocol | Synthetic data | Threshold key generation | Joint rotation keys | Per-site adapter fit and database setup | Diagonal-encoded matrix-vector multiply | Inner product against the local database | What is in the slots we do not read | Site contribution_fn: full per-site protocol step | Master orchestration and threshold-decrypted top-k | Reference-truth comparison | What the adapter buys: fidelity, posture, and a sweet spot | Discussion | Limitations | Related work | References

Last update: 2026-10-01
Started: 2026-04-29

Consensus ADMM with Gaussian Noise (Demonstration)
Introduction | The problem and its consensus split | Adding noise | A brief output-DP primer | The protocol modification | The stopping rule changes | Setup | Simulated cohort | Choosing $\rho$ and $T$ without touching the cohort | Threshold-FHE setup | The DP-ADMM loop | Centralized CVXR fit | The $\sigma$ sweep | Privacy budget | References

Last update: 2026-10-01
Started: 2026-04-26

Introduction to homomorpheR
The problem this package addresses | Terms you will meet | How the pieces fit together | Sites that are not in this R session | What "the right answer" means | Which vignette to read | A note on Paillier | References

Last update: 2026-10-01
Started: 2015-11-12

Threshold Cox with Gaussian Noise (Demonstration)
Introduction | A brief output-DP primer | The protocol | The Cox setup (same DLBCL data as the other Cox vignettes) | Threshold setup and DP-noised workers | Mechanical correctness: $\sigma = 0$ reproduces cox-threshold | Increasing noise: where does it break? | Nelder–Mead at the same noise scales | Privacy budget | References

Last update: 2026-10-01
Started: 2026-04-26

Distributed Cox Regression with Threshold Key Generation
Introduction | Threat model | The Cox setup (same DLBCL data as cox.Rmd) | The protocol | Implementation | Iterative MLE through the threshold protocol | Comparison with the cleartext fit | Discussion | Limitations

Last update: 2026-09-30
Started: 2026-04-26

Distributed Query Count with Threshold Keys
The problem | The target answer | Why the classic solution needed two non-cooperating parties | Threshold encryption removes the need for masking | The threshold-BFV implementation | The encrypted answer is exact | Summary

Last update: 2026-09-30
Started: 2026-07-17

Precision
Introduction | Exact, for integer schemes | Approximate, for CKKS

Last update: 2026-09-30
Started: 2026-09-07

Secure Model Inference on Encrypted Data
The use case | Scenario: weighted biomarker score | Setup: hospital's context and patient data | Lab side: apply the model to encrypted data | Hospital side: decrypt the results | Verification | Transport guarantees | Threat model: model extraction from the hospital side | Layered defenses | Network protocol: serialization

Last update: 2026-09-30
Started: 2026-04-26

Encrypted Logistic Regression Prediction
Overview | The setting | Step 1: train in the clear | Step 2: encrypt patient data | Step 3: evaluate the linear predictor (encrypted) | Step 4: apply the sigmoid (encrypted) | Step 5: decrypt predictions | Summary | Limitations

Last update: 2026-09-30
Started: 2026-04-26

Privacy-Preserving Count Aggregation
The problem | Setup | The aggregator sets up encryption | Each site computes locally and encrypts | The aggregator aggregates | Verification | The details of what happened | Serializing for a real distributed protocol

Last update: 2026-09-29
Started: 2026-04-26

Readme and manuals

Help Manual

Help pageTopics
Encrypt and decrypt with protocol actorsactor-decryption actor-encryption
Add a site to a non-cooperating partyadd_site
CKKS-backed masterCKKSMaster
A site's encrypted contribution at a parameter valuecontribute
Precomputed results for the 'cox' vignettecox_results
Precomputed results for the 'cox-threshold-dp' vignettecox_threshold_dp_results
Precomputed results for the 'cox-threshold' vignettecox_threshold_results
Precomputed results for the 'cvxr-consensus-admm-dp' vignettecvxr_admm_dp_results
Precomputed encrypted Cox-lasso consensus-ADMM resultscvxr_consensus
Diffuse Large B-cell Lymphoma Cohort (Rosenwald et al. 2002)DLBCL
DLBCL Lymphochip gene-expression matrixDLBCL_gex
Encrypt a real number under a Paillier public keyencrypt_real
Return the secret lambda from a private keyget_lambda
Return the private key from a key pairget_private_key
homomorpheR: privacy-preserving statistics across siteshomomorpheR-package homomorpheR
One site's step in the threshold key-generation chainkeygen_round
A site whose data lives in this R sessionLocalSite
Construct a CKKS-backed mastermake_ckks_master
Construct a Paillier-backed mastermake_master
Construct an NCPartymake_ncparty
Run threshold key generation across sites and construct the mastermake_threshold_master
Construct a workermake_worker
Abstract master classMaster
Run one round of the master/worker protocolmaster_aggregate
A non-cooperating partyNCParty
Public parameters for the 'openfhe.R' backendsOpenFHEParams
Generate a new Paillier key pairpaillier_keypair
A Paillier ciphertextPaillierCiphertext
A Paillier-encrypted real numberPaillierEncryptedReal
Paillier key pairPaillierKeyPair
Paillier-backed masterPaillierMaster
Public parameters for the frozen Paillier backendPaillierParams
Paillier private keyPaillierPrivateKey
Paillier public keyPaillierPublicKey
One site's partial decryption of a ciphertextpartial_decrypt
The public parameters a party encrypts underPublicParams
Random big integerrandom.bigz
A site whose contribution is produced outside this R sessionRemoteSite
Wire a master and a list of sites into a round-robin chainround_robin_chain
Run one round of the round-robin protocolrun_round_robin
Wire one site's 'next_site' to anotherset_next_site
Distribute the public key from the master to a downstream actorset_public_key
Give a party the public parameters it will encrypt underset_public_params
Wire a master to a flat list of workersset_workers
Precomputed results for the 'similarity' vignettesimilarity_results
A site in a multi-party protocolSite
The public parameters a party holdssite_params
Signal that a site could not be reachedsite_unavailable
Threshold-CKKS master (n-of-n key generation)ThresholdMaster