-
Notifications
You must be signed in to change notification settings - Fork 716
/
Copy pathhestdparms.h
147 lines (138 loc) · 4.43 KB
/
hestdparms.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#pragma once
#include "seal/util/defines.h"
#include <cstddef>
namespace seal
{
namespace util
{
/**
Largest allowed bit counts for coeff_modulus based on the security estimates from
HomomorphicEncryption.org security standard. Microsoft SEAL samples the secret key
from a ternary {-1, 0, 1} distribution.
*/
// Ternary secret; 128 bits classical security
SEAL_NODISCARD constexpr int seal_he_std_parms_128_tc(std::size_t poly_modulus_degree) noexcept
{
switch (poly_modulus_degree)
{
case std::size_t(1024):
return 27;
case std::size_t(2048):
return 54;
case std::size_t(4096):
return 109;
case std::size_t(8192):
return 218;
case std::size_t(16384):
return 438;
case std::size_t(32768):
return 881;
}
return 0;
}
// Ternary secret; 192 bits classical security
SEAL_NODISCARD constexpr int seal_he_std_parms_192_tc(std::size_t poly_modulus_degree) noexcept
{
switch (poly_modulus_degree)
{
case std::size_t(1024):
return 19;
case std::size_t(2048):
return 37;
case std::size_t(4096):
return 75;
case std::size_t(8192):
return 152;
case std::size_t(16384):
return 305;
case std::size_t(32768):
return 611;
}
return 0;
}
// Ternary secret; 256 bits classical security
SEAL_NODISCARD constexpr int seal_he_std_parms_256_tc(std::size_t poly_modulus_degree) noexcept
{
switch (poly_modulus_degree)
{
case std::size_t(1024):
return 14;
case std::size_t(2048):
return 29;
case std::size_t(4096):
return 58;
case std::size_t(8192):
return 118;
case std::size_t(16384):
return 237;
case std::size_t(32768):
return 476;
}
return 0;
}
// Ternary secret; 128 bits quantum security
SEAL_NODISCARD constexpr int seal_he_std_parms_128_tq(std::size_t poly_modulus_degree) noexcept
{
switch (poly_modulus_degree)
{
case std::size_t(1024):
return 25;
case std::size_t(2048):
return 51;
case std::size_t(4096):
return 101;
case std::size_t(8192):
return 202;
case std::size_t(16384):
return 411;
case std::size_t(32768):
return 827;
}
return 0;
}
// Ternary secret; 192 bits quantum security
SEAL_NODISCARD constexpr int seal_he_std_parms_192_tq(std::size_t poly_modulus_degree) noexcept
{
switch (poly_modulus_degree)
{
case std::size_t(1024):
return 17;
case std::size_t(2048):
return 35;
case std::size_t(4096):
return 70;
case std::size_t(8192):
return 141;
case std::size_t(16384):
return 284;
case std::size_t(32768):
return 571;
}
return 0;
}
// Ternary secret; 256 bits quantum security
SEAL_NODISCARD constexpr int seal_he_std_parms_256_tq(std::size_t poly_modulus_degree) noexcept
{
switch (poly_modulus_degree)
{
case std::size_t(1024):
return 13;
case std::size_t(2048):
return 27;
case std::size_t(4096):
return 54;
case std::size_t(8192):
return 109;
case std::size_t(16384):
return 220;
case std::size_t(32768):
return 443;
}
return 0;
}
// Standard deviation for error distribution
constexpr double seal_he_std_parms_error_std_dev = 3.2;
} // namespace util
} // namespace seal