BFV
The BFV package is an RNS-accelerated implementation of the Fan-Vercauteren version of Brakerski's scale-invariant homomorphic encryption scheme. It provides modular arithmetic over the integers.
Brief description
This scheme can be used to do arithmetic over .
The plaintext space and the ciphertext space share the same domain
withThe batch encoding of this scheme
maps an array of integers to a polynomial with the property:
where represents  a component-wise product,and  represents a nega-cyclic convolution.Security parameters
: the ring dimension, which defines the degree of the cyclotomic polynomial, and the number of coefficients of the plaintext/ciphertext polynomials; it should always be a power of two. This parameter has an impact on both security and performance (security increases with N and performance decreases with N). It should be carefully chosen to suit the intended use of the scheme.
: the ciphertext modulus. In Lattigo, it is chosen to be the product of small coprime moduli
that verify
in order to enable both the RNS and NTT representation. The used moduli
are chosen to be of size 50 to 60 bits for the best performance. This parameter has an impact on both security and performance (for a fixed
, a larger
implies both lower security and lower performance). It is closely related to
and should be chosen carefully to suit the intended use of the scheme.
: the variance used for the error polynomials. This parameter is closely tied to the security of the scheme (a larger
implies higher security).
Other parameters
: the extended ciphertext modulus. This modulus is used during the multiplication, and it has no impact on the security. It is also defined as the product of small coprime moduli
and should be chosen such that
by a small margin (~20 bits). This can be done by using one more small coprime modulus than
.
: the plaintext modulus. This parameter defines the maximum value that a plaintext coefficient can take. If a computation leads to a higher value, this value will be reduced modulo the plaintext modulus. It can be initialized with any value, but in order to enable batching, it must be prime and verify
. It has no impact on the security.
Choosing security parameters
The BFV scheme supports the standard recommended parameters chosen to offer a security of 128 bits for a secret key with uniform ternary distribution , according to the Homomorphic Encryption Standards group (https://homomorphicencryption.org/standard/).
Each set of parameters is defined by the tuple :
- {12, 109, 3.2}
- {13, 218, 3.2}
- {14, 438, 3.2}
- {15, 881, 3.2}
These parameter sets are hard-coded in the file params.go. By default the variance should always be set to 3.2 unless the user is perfectly aware of the security implications of changing this parameter.
Finally, it is worth noting that these security parameters are computed for fully entropic ternary keys (with probability distribution {1/3,1/3,1/3} for values {-1,0,1}). Lattigo uses this fully-entropic key configuration by default. It is possible, though, to generate keys with lower entropy, by modifying their distribution to {(1-p)/2, p, (1-p)/2}, for any p between 0 and 1, which for p>>1/3 can result in low Hamming weight keys (sparse keys). We recall that it has been shown that the security of sparse keys can be considerably lower than that of fully entropic keys, and the BFV security parameters should be re-evaluated if sparse keys are used.