OpenFHE-Python: BFV Threshold

Hello,
This issue is based on the example provided in the repository openfhe-python/examples/pke/threshold-fhe-5p.py.

When I run the file, I get the supposedly correct output:

 Original Plaintext: 

( 1 2 3 4 5 6 5 4 3 2 1 ... )
( 1 0 0 1 1 ... )
( 2 2 3 4 5 6 7 8 9 10 ... )

 Resulting Fused Plaintext: 

( 4 4 6 9 11 12 12 12 12 12 1 ... )



 Resulting Fused Plaintext after Multiplication of plaintexts 1 and 3: 

( 1 32 243 1024 3125 7776 3125 1024 243 32 1 ... )



 Fused result after the Summation of ciphertext 3: 

( 56 54 52 49 45 40 34 27 19 10 ... )

Then, I did the following modifications :

  • parameters.SetThresholdNumOfParties(5) → parameters.SetThresholdNumOfParties(3)
  • I only used the first 3 (out of 5) partial decrypts of each list used as input of MultipartyDecryptFusion,

I obtained the following output:


 Original Plaintext: 

( 1 2 3 4 5 6 5 4 3 2 1 ... )
( 1 0 0 1 1 ... )
( 2 2 3 4 5 6 7 8 9 10 ... )

 Resulting Fused Plaintext: 

( 4618 -24943 18873 2235 21991 -6427 -28758 2949 6309 -20429 -30074 -14833 ... )



 Resulting Fused Plaintext after Multiplication of plaintexts 1 and 3: 

( -13584 12354 6146 -474 20337 6535 -32265 7222 -28725 -30276 -17296 -26837 ... )



 Fused result after the Summation of ciphertext 3: 

( 13735 2239 -21315 14559 -13415 5429 27787 27981 20517 17689 -30053 5278 ... )

Edit : Using the first 4 elements of each list, I get the following:

 Original Plaintext: 

( 1 2 3 4 5 6 5 4 3 2 1 ... )
( 1 0 0 1 1 ... )
( 2 2 3 4 5 6 7 8 9 10 ... )

 Resulting Fused Plaintext: 

( -28553 21134 30056 11726 30949 4400 -31747 29014 -6299 31757 -15025 18083 ... )



 Resulting Fused Plaintext after Multiplication of plaintexts 1 and 3: 

( -9813 21457 30218 17305 -26711 -25069 -15120 -26709 -32198 28855 14267 -4523 ... )



 Fused result after the Summation of ciphertext 3: 

( 4833 14130 20550 -23265 -17613 5225 10538 17882 24686 -32048 28714 30208 ... )

Is it the expected behavior ? If yes, I would greatly appreciate an explanation.

Sincerely,

SetThresholdNumOfParties expects the total number of parties and is used to generate the parameters. For a t-out-of-n setting where t < n, please see the description of threshold decryption with aborts and a small example here to understand the kind of capability currently implemented in OpenFHE.

Hello,
Looks like I misunderstood the method SetThresholdNumOfParties, thank you for linking this.

Is it possible to do it with the Python wrapper ?
I see no mention of ShareKeys and RecoverSharedKey in Welcome to OpenFHE - Python’s documentation! — openfhe-python 0.8.0 documentation or when creating contexts.