Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
seal::util::IterTuple<...>
where a part of the value_type
was constructed incorrectly.Evaluator::mod_switch_drop_to_next
that caused non-inplace modulus switching to fail (Issue 179). Thanks s0l0ist!seal::util::iter
and seal::util::reverse_iter
functions that can create any type of iterator from appropriate parameters.seal::util::SeqIter<T>
iterator for iterating a sequence of numbers for convenient iteration indexing.seal/util/polyarithsmallmod.*
to use iterators; this is to reduce the layers of iteration in higher level code.SEAL_ITERATE
that should be used instead of for_each_n
.Evaluator::multiply_plain_inplace
. Thanks s0l0ist!CMakeLists.txt
.CMakeLists.txt
that builds all native components.SEAL::seal
(static library), SEAL::seal_shared
(shared library; optional), SEAL::sealc
(C export library; optional).native/src/gsl
and installed with Microsoft SEAL.Serialization::SEALHeader
layout has been changed. SEAL 3.4 objects can still be loaded by SEAL 3.5, and the headers are automatically converted to SEAL 3.5 format.Serialization::SEALHeader
captures version number information.Encryptor
's symmetric-key encryption and KeyGenerator
's RelinKeys
and GaloisKeys
generation now output Serializable
objects. See more details in API Changes below.We have created a set of C++ iterators that easily allows looping over polynomials in a ciphertext, over RNS components in a polynomial, and over coefficients in an RNS component. There are also a few other iterators that can come in handy. Currently Evaluator
fully utilizes these, and in the future the rest of the library will as well.
The iterators are primarily intended to be used with std::for_each_n
to simplify existing code and help with code correctness. Please see native/src/seal/util/iterator.h for guidance on how to use these.
We have also completely rewritten the RNS tools that were previously in the util::BaseConverter
class. This functionality is now split between two classes: util::BaseConverter
whose sole purpose is to perform the FastBConv
computation of [BEHZ16] and util::RNSTool
that handles almost everything else. RNS bases are now represented by the new util::RNSBase
class.
The following changes are explained in C++ syntax and are introduced to .NET wrappers similarly:
Serializable
wraps Ciphertext
, RelinKeys
, and GaloisKeys
objects to provide a more flexible approach to the functionality provided in release 3.4 by KeyGenerator::[relin|galois]_keys_save
and Encryptor::encrypt_[zero_]symmetric_save
functions. Specifically, these functions have been removed and replaced with overloads of KeyGenerator::[relin|galois]_keys
and Encryptor::encrypt_[zero_]symmetric
that return Serializable
objects. The KeyGenerator::[relin|galois]_keys
methods in release 3.4 are renamed to KeyGenerator::[relin|galois]_keys_local
. The Serializable
objects cannot be used directly by the API, and are only intended to be serialized, which activates the compression functionalities introduced earlier in release 3.4.SmallModulus
class is renamed to Modulus
, and is relocated to native/src/seal/modulus.h.*coeff_mod_count*
methods are renamed to *coeff_modulus_size*
, which applies to many classes.parameter_error_name
and parameter_error_message
methods are added to EncryptionParameterQualifiers
and SEALContext
classes to explain why an EncryptionParameters
object is invalid.Serialization::SEALHeader
have changed.The following changes are specific to C++:
SEAL_POLY_MOD_DEGREE_MAX
is increased to 131072; values bigger than 32768 require the security check to be disabled by passing sec_level_type::none
to SEALContext::Create
.SEAL_COEFF_MOD_COUNT_MAX
is increased to 64.SEAL_MOD_BIT_COUNT_MAX
and SEAL_MOD_BIT_COUNT_MIN
are added and set to 61 and 2, respectively.SEAL_INTERNAL_MOD_BIT_COUNT
is added and set to 61.EncryptionParameterQualifiers
now has an error code parameter_error
that interprets the reason why an EncryptionParameters
object is invalid.bool parameters_set()
is added to replace the previous bool parameters_set
member.The following changes are specific to .NET:
SEALVersion
class.SEAL_POLY_MOD_DEGREE_MAX
and SEAL_COEFF_MOD_COUNT_MAX
in native/src/seal/util/defines.h.(Issue 150, Issue 84)std::invalid_argument
(native) or ArgumentException
(.NET)..clang-format
for automated formatting of C++ (.cpp
and .h
) files. Execute tools/scripts/clang-format-all.sh
for easy formatting (UNIX-like systems only). This is compatible with clang-format-9 and above. Formatting for C# is not yet supported.(Issue 93)
dotnet/native/
is moved to native/src/seal/c/ and renamed to SEAL_C to support building of wrapper libraries in languages like .NET, Java, Python, etc.Evaluator
are in general improved.(PR 148) This is compiler-dependent, however, and currently Clang seems to produce the fastest running code for Microsoft SEAL.Renamed files and directories:
dotnet/examples/6_Performance.cs
native/examples/6_performance.cpp
dotnet/native/sealnet
.native/src/seal/util/smallntt.h
.native/src/seal/util/smallntt.cpp
.native/tests/seal/util/smallntt.cpp
.New files:
Removed files:
dotnet/src/SmallModulus.cs
is merged to dotnet/src/ModulusTests.cs.dotnet/tests/SmallModulusTests.cs
is merged to dotnet/tests/ModulusTests.cs.native/src/seal/util/baseconverter.h
native/src/seal/util/baseconverter.cpp
native/src/seal/smallmodulus.h
is merged to native/src/seal/modulus.h.native/src/seal/smallmodulus.cpp
is merged to native/src/seal/modulus.cpp.native/src/seal/c/smallmodulus.h
is merged to native/src/seal/c/modulus.h.native/src/seal/c/smallmodulus.cpp
is merged to native/src/seal/c/modulus.cpp.native/tests/seal/smallmodulus.cpp
is merged to native/tests/seal/modulus.cpp.native/tests/seal/util/baseconverter.cpp
In this version, we have significantly improved the usability of the CKKS scheme in Microsoft SEAL and many of these improvements apply to the BFV scheme as well. Homomorphic operations that are based on key switching, i.e., relinearization and rotation, do not consume any noise budget (BFV) or impact accuracy (CKKS). The implementations of these operations are significantly simplified and unified, and no longer use bit decomposition, so decomposition bit count is gone. Moreover, fresh ciphertexts now have lower noise. These changes have an effect on the API and it will be especially worthwhile for users of older versions of the library to study the examples and comments in native/examples/3_levels.cpp (C++) or dotnet/examples/3_Levels.cs (C#).
The setup of EncryptionParameters
has been made both easier and safer
(see API Changes below).
The examples in native/examples/ and dotnet/examples/ have been redesigned to better teach the multiple technical concepts required to use Microsoft SEAL correctly and efficiently, and more compactly demonstrate the API.
Deleted header files:
New header files:
RelinKeys
and GaloisKeys
)In class SEALContext
:
context_data(parms_id_type)
with get_context_data(parms_id_type)
;context_data()
;key_context_data()
, key_parms_id()
, first_context_data()
, and
last_context_data()
;using_keyswitching()
that indicates whether key switching is supported
in this SEALContext
;Create(...)
in C++, and constructor in C#, now accepts an optional security
level based on
HomomorphicEncryption.org security standard,
causing it to enforce the specified security level. By default a 128-bit
security level is used.prev_context_data()
method to class ContextData
(doubly linked modulus
switching chain);SEALContext
now has a public constructor.Parameter selection:
DefaultParams
class;coeff_modulus
for the BFV scheme are now accessed through the function
CoeffModulus::BFVDefault(...)
. These moduli are not recommended for the CKKS scheme;coeff_modulus
for the CKKS scheme can be created using
CoeffModulus::Create(...)
which takes the poly_modulus_degree
and a vector of
bit-lengths of the prime factors as arguments. It samples suitable primes close to
2^bit_length and returns a vector of SmallModulus
elements.PlainModulus::Batching(...)
can be used to sample a prime for plain_modulus
that supports BatchEncoder
for the BFV scheme.Other important changes:
size_capacity
function and data members from Ciphertext
class;is_valid_for
and is_metadata_valid_for
to valcheck.h
;decomposition_bit_count
from methods relin_keys(...)
and
galois_keys(...)
in class KeyGenerator
;Encryptor
;SmallModulus
;RelinKeys
and GaloisKeys
are now derived from a common base class
KSwitchKeys
;