这是来自 Microsoft SEAL-3.4 库的 seal / keygenerator.h 中对 GaloisKey 的描述:
/**
Generates and returns Galois keys. This function creates specific Galois
keys that can be used to apply specific Galois automorphisms on encrypted
data. The user needs to give as input a vector of Galois elements
corresponding to the keys that are to be created.
The Galois elements are odd integers in the interval [1, M-1], where
M = 2*N, and N = poly_modulus_degree. Used with batching, a Galois element
3^i % M corresponds to a cyclic row rotation i steps to the left, and
a Galois element 3^(N/2-i) % M corresponds to a cyclic row rotation i
steps to the right. The Galois element M-1 corresponds to a column rotation
(row swap) in BFV, and complex conjugation in CKKS. In the polynomial view
(not batching), a Galois automorphism by a Galois element p changes
Enc(plain(x)) to Enc(plain(x^p)).
@param[in] galois_elts The Galois elements for which to generate keys
@throws std::logic_error if the encryption parameters do not support
batching and scheme is scheme_type::BFV
@throws std::logic_error if the encryption parameters do not support
keyswitching
@throws std::invalid_argument if the Galois elements are not valid
*/
SEAL_NODISCARD inline GaloisKeys galois_keys(
const std::vector<std::uint64_t> &galois_elts)
{
return galois_keys(galois_elts, false);
}
如何为 GaloisKey 创建更好的 Galois 元素。
一般来说:
GaloisKey gal_keys = keygen.galois_keys();
但是密文第一次旋转是正确的,第二次旋转是错误的。
具体的错误是,比如我的一个密文是[0.0001,0.0001, ... 0.0001],旋转后解密为[1.0000,1.2000,1.7000 ...]