0

Suppose I have two vectors x = [1,2,3,4] and y = [5,1,2,6].

I composed and encrypted the two array using PolyCRTBuilder ( Ciphertextx and Ciphertexty ) .

If I subtract the two ciphertexts ( Ciphertextx MINUS Ciphertexty ), I should get Result = [-4, 1, 1, -2] but after the homomorphic subtraction I am getting ResultDecrypted = [40957, 1, 1, 40959] .

I understood that because the plaintext is only defined modulo plain_modulus, we got that result. But i want the resultant negative values to be used for the next computation how can i assign the resultant negative values to a vector and use the same for the further computations

Rot-man
  • 18,045
  • 12
  • 118
  • 124

1 Answers1

0

You are using a pretty old version of SEAL if it still has PolyCRTBuilder; in newer versions of the library this has been renamed to BatchEncoder and it supports encoding to/from std::vector<std::int64_t> which, I believe, is what you want.

Kim Laine
  • 856
  • 5
  • 10
  • Sir, where can i get the python wrapper for SEAL Version 3.2?? – mahesh morampudi Apr 10 '19 at 09:04
  • There is no Python wrapper for SEAL 3.2. – Kim Laine Apr 10 '19 at 15:30
  • Will dotnet version of SEAL works in visual studio 2019. When i am trying to execute Examples.cs it is unable to "include the header files". – mahesh morampudi Apr 15 '19 at 05:49
  • I noticed that too when trying earlier, but didn't have a chance yet to look into what is causing it. Obviously this must and will be fixed. – Kim Laine Apr 15 '19 at 06:02
  • Sir, is there any chance of releasing a python wrapper for SEAL version 3.2? – mahesh morampudi Apr 15 '19 at 06:27
  • Sir, what modification i have to do in the older version of SEAL(polycrtbuilder::compose) in order to operate correctly with negative numbers??? – mahesh morampudi Apr 15 '19 at 11:52
  • Well, just look at what the (new) BatchEncoder versions of these compose and decompose functions do and replicate that. It should be pretty straightforward. – Kim Laine Apr 16 '19 at 15:03
  • Sir, I compared the compose and decompose functions of the PolyCRTBuilder with encode and decode functions of BatchEncoder (Newer Version). I identified the difference between the two is when negative values occured, in the newer version static_cast was used to typecast the values. I did the same modification in the older version still no change in the result. Please help me in this regard as dotnet wrapper is showing errors "unable to include header files". – mahesh morampudi Apr 23 '19 at 06:47
  • If you don't see any change in the result that should be easy to debug: is the signed-unsigned conversion not hit because of some incorrect branch condition? Also note that it is NOT just a static cast but the conversion involves also other stuff. I can't help you port new SEAL functionality to old. Why not just use a newer version of SEAL where all these issues go away? SEAL 2.3 or whatever you are using has a ton of issues that have been fixed in subsequent releases. I don't understand how the dotnet wrappers are related to this. – Kim Laine Apr 23 '19 at 19:14
  • What type of data will be present in Ciphertext object??Is it possible to access the data which is their in Ciphertext object?? – mahesh morampudi May 03 '19 at 04:10