Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 8df1314

Browse files
author
Todd Stavish
committed
add EncryptionParameterQualifiers
1 parent a2e2f82 commit 8df1314

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

SEALPython/wrapper.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,20 @@ PYBIND11_MODULE(seal, m) {
3535
.def("set_coeff_modulus",
3636
(void (EncryptionParameters::*)(const std::string &)) &EncryptionParameters::set_coeff_modulus,
3737
"Set coefficient modulus parameter")
38+
.def("set_plain_modulus",
39+
(void (EncryptionParameters::*)(const BigUInt &)) &EncryptionParameters::set_plain_modulus,
40+
"Set plaintext modulus parameter")
41+
.def("set_plain_modulus",
42+
(void (EncryptionParameters::*)(std::uint64_t)) &EncryptionParameters::set_plain_modulus,
43+
"Set plaintext modulus parameter")
44+
.def("set_plain_modulus",
45+
(void (EncryptionParameters::*)(const std::string &)) &EncryptionParameters::set_plain_modulus,
46+
"Set plaintext modulus parameter")
3847
.def("set_poly_modulus",
3948
(void (EncryptionParameters::*)(const std::string &)) &EncryptionParameters::set_poly_modulus,
40-
"Set polynomial modulus parameter");
49+
"Set polynomial modulus parameter")
50+
.def("validate", &EncryptionParameters::validate,
51+
"Validates parameters");
52+
53+
py::class_<EncryptionParameterQualifiers>(m, "EncryptionParameterQuailifers");
4154
}

SEALPythonExamples/examples.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,23 @@ def example_basics():
6464
# coeff_modulus has a strong negative effect on the security level.
6565
parms.set_coeff_modulus(ChooserEvaluator.default_parameter_options()[2048]);
6666

67+
# Now we set the plaintext modulus. This can be any positive integer, even
68+
# though here we take it to be a power of two. A larger plaintext modulus
69+
# causes the noise to grow faster in homomorphic multiplication, and also
70+
# lowers the maximum amount of noise in ciphertexts that the system can
71+
# tolerate (see above). On the other hand, a larger plaintext modulus
72+
# typically allows for better homomorphic integer arithmetic, although this
73+
# depends strongly on which encoder is used to encode integers into
74+
# plaintext polynomials.
75+
parms.set_plain_modulus(1 << 8)
76+
77+
78+
# Once all parameters are set, we need to call
79+
# EncryptionParameters::validate(), which evaluates the properties of the
80+
# parameters, their validity for homomorphic encryption, and performs some
81+
# important pre-computation.
82+
parms.validate()
83+
6784
def main():
6885
# Example: Basics
6986
example_basics()

0 commit comments

Comments
 (0)