PaillierPublicKey: Construct a Paillier public key with the given modulus.

PaillierPublicKeyR Documentation

Construct a Paillier public key with the given modulus.

Description

Construct a Paillier public key with the given modulus.

Construct a Paillier public key with the given modulus.

Format

An R6Class generator object

Public fields

bits

the number of bits in the modulus

n

the modulus

nSquared

the square of the modulus

nPlusOne

one more than the modulus

Methods

Public methods


Method new()

Create a new public key and precompute some internal values for efficiency

Usage
PaillierPublicKey$new(bits, n)
Arguments
bits

number of bits to use

n

the modulus to use

Returns

a new PaillierPublicKey object


Method encrypt()

Encrypt a message

Usage
PaillierPublicKey$encrypt(m)
Arguments
m

the message

Returns

the encrypted message


Method add()

Add two encrypted messages

Usage
PaillierPublicKey$add(a, b)
Arguments
a

a message

b

another message

Returns

the sum of a and b


Method sub()

Subtract one encrypted message from another

Usage
PaillierPublicKey$sub(a, b)
Arguments
a

a message

b

another message

Returns

the difference a - b


Method add_real()

Return the sum a + b of an encrypted real message a, a list consisting of a encrypted integer part (named int) and an encrypted fractional part (named frac), and a real number a using den as denominator in the rational approximation.

Usage
PaillierPublicKey$add_real(den, a, b)
Arguments
den

the denominator to use for rational approximations

a

the real message, a list consisting of the integer and fractional parts named int and frac respectively

b

a simple real number


Method sub_real()

Return the difference a - b of an encrypted real message a, a list consisting of a encrypted integer part (named int) and an encrypted fractional part (named frac), and a real number b using den as denominator in the rational approximation.

Usage
PaillierPublicKey$sub_real(den, a, b)
Arguments
den

the denominator to use for rational approximations

a

the real message, a list consisting of the integer and fractional parts named int and frac respectively

b

a simple real number


Method mult()

Return the product of two encrypted messages a and b

Usage
PaillierPublicKey$mult(a, b)
Arguments
a

a message

b

another message

Returns

the product of a and b


Method clone()

The objects of this class are cloneable with this method.

Usage
PaillierPublicKey$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

PaillierPrivateKey which goes hand-in-hand with this object


bnaras/homomorpheR documentation built on April 7, 2022, 5:06 a.m.