inst/doc/introduction.R

## ----echo=F--------------------------------------------------------------
### get knitr just the way we like it

knitr::opts_chunk$set(
  message = FALSE,
  warning = FALSE,
  error = FALSE,
  tidy = FALSE,
  cache = FALSE
)


## ------------------------------------------------------------------------
library(homomorpheR)
keyPair <- PaillierKeyPair$new(modulusBits = 1024)

## ------------------------------------------------------------------------
keyPair

## ------------------------------------------------------------------------
encryptAndDecrypt <- function(x) keyPair$getPrivateKey()$decrypt(keyPair$pubkey$encrypt(x))

## ------------------------------------------------------------------------
a <- gmp::as.bigz(1273849)
identical(a + 10, encryptAndDecrypt(a + 10))

## ------------------------------------------------------------------------
m <- lapply(1:100, function(x) random.bigz(nBits = 512))
md <- lapply(m, encryptAndDecrypt)
identical(m, md)

Try the homomorpheR package in your browser

Any scripts or data that you put into this service are public.

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