seal库BGV同态加密解析

seal库参数设置

先看seal库源码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const map<size_t, vector<Modulus>> &GetDefaultCoeffModulus128()
{
static const map<size_t, vector<Modulus>> default_coeff_modulus_128{
/*
Polynomial modulus: 1x^1024 + 1
Modulus count: 1
Total bit count: 27
*/
{ 1024, { 0x7e00001 } },

/*
Polynomial modulus: 1x^2048 + 1
Modulus count: 1
Total bit count: 54
*/
{ 2048, { 0x3fffffff000001 } },

/*
Polynomial modulus: 1x^4096 + 1
Modulus count: 3
Total bit count: 109 = 2 * 36 + 37
*/
{ 4096, { 0xffffee001, 0xffffc4001, 0x1ffffe0001 } },

/*
Polynomial modulus: 1x^8192 + 1
Modulus count: 5
Total bit count: 218 = 2 * 43 + 3 * 44
*/
{ 8192, { 0x7fffffd8001, 0x7fffffc8001, 0xfffffffc001, 0xffffff6c001, 0xfffffebc001 } },

/*
Polynomial modulus: 1x^16384 + 1
Modulus count: 9
Total bit count: 438 = 3 * 48 + 6 * 49
*/
{ 16384,
{ 0xfffffffd8001, 0xfffffffa0001, 0xfffffff00001, 0x1fffffff68001, 0x1fffffff50001,
0x1ffffffee8001, 0x1ffffffea0001, 0x1ffffffe88001, 0x1ffffffe48001 } },

/*
Polynomial modulus: 1x^32768 + 1
Modulus count: 16
Total bit count: 881 = 15 * 55 + 56
*/
{ 32768,
{ 0x7fffffffe90001, 0x7fffffffbf0001, 0x7fffffffbd0001, 0x7fffffffba0001, 0x7fffffffaa0001,
0x7fffffffa50001, 0x7fffffff9f0001, 0x7fffffff7e0001, 0x7fffffff770001, 0x7fffffff380001,
0x7fffffff330001, 0x7fffffff2d0001, 0x7fffffff170001, 0x7fffffff150001, 0x7ffffffef00001,
0xfffffffff70001 } }
};

return default_coeff_modulus_128;
}

这是BGV的128bit安全性参数设置,随着模多项式的次数\(n\)不同,对应的密文模数的大小\(log(q)\)也有调整,具体的公式可以按照下面的方法计算: \[ \lambda \approx -log(\cfrac{A*log(q)}{n})\cfrac{Bn}{logq} + C\sqrt{\cfrac{logq}{n}}log(\cfrac{n}{log(q)}) \] image-20230309155417529

BGV噪声变化


http://example.com/2023/03/09/seal库使用/
作者
harper
发布于
2023年3月9日
许可协议