homomorpheR: homomorpheR: Homomorphic computations in R

Description Details References Examples

Description

homomorpheR is a start at a rudimentary package for homomorphic computations in R. The goal is to collect homomorphic encryption schemes in this package for privacy-preserving distributed computations; for example, applications of the sort immplemented in package distcomp.

Details

At the moment, only one scheme is implemented, the Paillier scheme. The current implementation makes no pretense at efficiency and also uses direct translations of other implementations, particularly the one in Javascript.

For a quick overview of the features, read the homomorpheR vignette by running vignette("homomorpheR").

References

https://en.wikipedia.org/wiki/Homomorphic_encryption

https://mhe.github.io/jspaillier/

Examples

1
2
3
4
5
6
7
keys <- PaillierKeyPair$new(1024) # Generate new key pair
encryptAndDecrypt <- function(x) keys$getPrivateKey()$decrypt(keys$pubkey$encrypt(x))
a <- gmp::as.bigz(1273849)
identical(a + 10L, encryptAndDecrypt(a+10L))
x <- lapply(1:100, function(x) random.bigz(nBits = 512))
edx <- lapply(x, encryptAndDecrypt)
identical(x, edx)

Example output

[1] TRUE
[1] TRUE

homomorpheR documentation built on May 2, 2019, 8:18 a.m.