enc: Encrypt a message

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/enc.R

Description

This encrypts an integer message under one of the homomorphic encryption schemes supported by this package.

Usage

1
enc(pk, m)

Arguments

pk

a public key for any scheme as generated by the keygen. function.

m

an integer to be encrypted. Note that the permissable range of values for m is dependent on the scheme and the parameters of the scheme. m may even be resticted to as little as {0,1}, for example in binary encryption schemes.

Details

The scheme to use is determined by the public key which contains the parameter values for that scheme as part of it.

If a symmetric key scheme is being used, then the secret key should be provided for the pk argument.

Value

A ciphertext under the encryption scheme, encrypted using the public key provided.

Author(s)

Louis Aslett

See Also

keygen to create public/private keypairs; dec to decrypt the ciphertext generated by this function.

Examples

1
2
3
4
p <- pars("FandV")
keys <- keygen(p)
ct <- enc(keys$pk, 1)
dec(keys$sk, ct)

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