Vectors: Vectors of cipher texts

Description Usage Details Examples

Description

Vectors of cipher texts can be seemlessly created and manipulated in the same way one normally works with vectors in R.

Usage

1
2
3
4
5
6
7
8
9
enc(keys$pk1, c(m1, m2, ...))
c(ct1, ct2)

ct1 + ct2
ct1 - ct2
ct1 * ct2
ct1 %*% ct2
sum(ct1)
prod(ct1)

Details

Vectors of cipher texts can be seemlessly created either at encryption time by passing a vector message argument to enc, or after encryption using the standard concatenation operator c.

Standard operations which can be used on regular vectors can also be used on vectors of cipher texts, where the scheme supports it.

As with regular scalar operations, note that not all homomorphic encryption schemes will support all vector operations. Also, it is important to note that typically homomorphic operations cause an increase in the noise within a ciphertext. Once a certain number of operations have taken place the cipertext may no longer correctly decrypt. If a scheme is *fully* homomorphic, then it may be possible to apply a bootstrapping procedure which reduces the noise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
p <- pars("FandV")
keys <- keygen(p)
ct1 <- enc(keys$pk, c(2,3))
ct2 <- enc(keys$pk, c(4,5))
ctConcat <- c(ct1, ct2)
ctAdd <- ct1 + ct2
ctSub <- ct1 - ct2
ctMul <- ct1 * ct2
ctIP <- ct1 %*% ct2

# Decrypt to the equivalent of the above operations applied to the vectors
# c(2,3) and c(4,5)
dec(keys$sk, ctConcat)
dec(keys$sk, ctAdd)
dec(keys$sk, ctSub)
dec(keys$sk, ctMul)
dec(keys$sk, ctIP)

iamtrask/R-Homomorphic-Encryption-Package documentation built on May 29, 2019, 2:56 p.m.