bnaras / homomorpheR

Homomorphic Computations in R
Other
4 stars 0 forks source link

Are comparisons possible? #4

Open stephenturner opened 2 years ago

stephenturner commented 2 years ago

Please forgive me, new to this domain. Is it possible to implement a comparison using the Paillier cryptosystem implemented in homomorpher? I'd like to do something like adding up all the elements of two vectors that are identical. This isn't working obviously.

library(homomorpheR)

keyPair <- PaillierKeyPair$new(modulusBits = 1024)

gt1 <- gmp::as.bigz(c(1,2,3,4,5))
gt2 <- gmp::as.bigz(c(1,0,3,0,5))

sum(gt1==gt2)
#> [1] 3

keyPair$pubkey$encrypt(gt1)==keyPair$pubkey$encrypt(gt2)
#> [1] FALSE FALSE FALSE FALSE FALSE
stephenturner commented 2 years ago

Updated, apologies for the initial empty post