ibarrond / Pyfhel

PYthon For Homomorphic Encryption Libraries, perform encrypted computations such as sum, mult, scalar product or matrix multiplication in Python, with NumPy compatibility. Uses SEAL/PALISADE as backends, implemented using Cython.
https://pyfhel.readthedocs.io/
Apache License 2.0
475 stars 78 forks source link

How to duplicate the same number or set of numbers across an encrypted array? #220

Closed meirgold closed 10 months ago

meirgold commented 11 months ago

Hi,

Assuming I have an encrypted array where the first cell has a certain value and the rest of the cells are zeros. What would be your best recommendation for copying this value across a consecutive number of cells in the array?

For example, if my input encrypted array holds [5,0,0,0,0,0,0....], the output should hold: [5,5,5,5,5,0,0,0,0...]

I have an algorithm that I wrote using shifts and addition (I shift by 2^n and add to the array, increasing n each time), but I noticed that this could be time consuming and the number of cells across which I want to duplicate is not necessarily a power of two.

Same question for a group of numbers: now I have an encrypted array with X values in the first X cells. I wish to duplicate these X values across a consecutive mount of cells. For example, if my inpuit encrypted array holds [1,2,3,0,0,0,0,0,0...] the output should hold: [1,2,3,1,2,3,1,2,3,0,0,0,0,0,0...]

Thanks,

Meir