Closed lastmjs closed 4 years ago
You can certainly set plaintext_modulus
to 2 in SEAL BFV. Then it provides everything you need. However, BatchEncoder
does not work with such a plaintext_modulus
.
Adding batching support is not easy and will decrease the performance of homomorphic evaluation by a lot. Even worse, if we add that support, performance of operations in SEAL will diverge. For example, choosing plaintext_modulus
as 2 or a power of 2 will have much slower Ciphertext multiplication and encryption size expansion, compared to current SEAL. Most of use scenarios were made practical because of fast computation and small encryption size expansion. Although algorithms in binary is natural to developers, algorithms in a different number representation can serve the same purpose too, they are just harder to design. In either words, binary operation is not yet a major block.
We will definitely add that support when we have a solution to maintain the simple API and fast speed of SEAL.
How would you go about doing operations in binary? Let's say that my plain text inputs were arrays of 1s and 0s, and I want to do two's complement additions and subtractions. I don't believe there's a built-in way to do this, so how would you do it otherwise? Actually, it's easy to do ANDs or ORs with multiplication, but I don't think addition or subtraction is easily possible from what I can tell.
I believe HElib has built-in support for binary operations. If this library doesn't have that, I think it would be a great addition.