The mod function plays a critical role in numerous data encoding and cryptographic primitives. However, the widely used CKKS homomorphic encryption (HE) scheme supports only arithmetic operations, making it difficult to perform mod computations on encrypted data. Approximating the mod function with polynomials has therefore become an important yet challenging problem. The discontinuous and periodic characteristics of the mod function make it particularly difficult to approximate accurately under HE. Existing homomorphic mod constructions provide accurate results only within limited subranges of the input range, leaving the problem of achieving accurate approximation across the full input range unresolved. In this work, we propose a novel method based on polynomial interpolation and Chebyshev series to accurately approximate the mod function. Building upon this, we design two efficient data packing schemes, BitStack and CRTStack, tailored for small-integer inputs in CKKS. These schemes significantly improve the utilization of the CKKS plaintext space and enable efficient ciphertext uploads. Furthermore, we apply the proposed HE mod function to implement a homomorphic rounding operation and a general transformation from additive secret sharing to CKKS ciphertexts, achieving accurate ciphertext rounding and complete secret-share-to-CKKS conversion. Experimental results demonstrate that our approach achieves high approximation accuracy (up to 1e-8). Overall, our work provides a practical and general solution for performing mod operations under CKKS, extending its applicability to a broader range of privacy-preserving computations.
翻译:模函数在众多数据编码与密码学原语中扮演着关键角色。然而,广泛使用的CKKS同态加密方案仅支持算术运算,难以在加密数据上执行模运算。因此,利用多项式近似模函数成为一个重要而具有挑战性的问题。模函数的不连续性与周期性特征使其在同态加密环境下尤其难以精确近似。现有的同态模构造方法仅在输入范围的有限子区间内提供精确结果,尚未解决在整个输入范围内实现精确近似的问题。本文提出一种基于多项式插值与切比雪夫级数的新方法,以精确近似模函数。在此基础上,我们针对CKKS中的小整数输入设计了两种高效数据打包方案:BitStack与CRTStack。这些方案显著提升了CKKS明文空间的利用率,并实现了高效的密文上传。进一步地,我们将所提出的同态模函数应用于实现同态舍入操作以及从加法秘密共享到CKKS密文的通用转换,实现了精确的密文舍入与完整的秘密共享至CKKS转换。实验结果表明,我们的方法达到了较高的近似精度(最高达1e-8)。总体而言,本工作为在CKKS下执行模运算提供了实用且通用的解决方案,将其适用性扩展至更广泛的隐私保护计算领域。