Skip to content

Can't seem to match parameters between two ciphertexts, ValueError: encrypted1 and encrypted2 parameter mismatch #267

@acklay4

Description

@acklay4

";" Is to determine where a line ends, since github won't seem to end lines inside code blocks
Every Pyfhel object is an exact copy (using pickle), so every server has the same Pyfhel object and context.
In my scenario, the server calculates the following: 1/2 (x + y)

z = fhe_x + fhe_y; z = ~(z * self.one_half);

(I tried the inline operation z *= self.one_half only to realize that it doesn't relinearize it)
then sends this to a second server, which tries to add to another Ctxt to this:

temp: PyCtxt = HE_s.encryptFrac(np.array([1.2, 0], dtype=np.float64)); HE_s.rescale_to_next(z); z.round_scale(); temp.round_scale();

I then print the Ctxts before attemting to add these two:
print(z.scale); print(temp.scale); print(z); print(temp);

which produces:

1073741824.0
1073741824.0
<Pyfhel Ciphertext at 0x7f3a8dd04360, scheme=ckks, size=2/2, scale_bits=30, mod_level=0>
<Pyfhel Ciphertext at 0x7f3a84ac67a0, scheme=ckks, size=2/2, scale_bits=30, mod_level=0>

which, in my mind, matches parameters?

But when I then try to add these two together: z = z + temp it produces this error:

File "Pyfhel/PyCtxt.pyx", line 358, in Pyfhel.PyCtxt.PyCtxt.add
File "Pyfhel/Pyfhel.pyx", line 1027, in Pyfhel.Pyfhel.Pyfhel.add
File "Pyfhel/Pyfhel.pyx", line 1047, in Pyfhel.Pyfhel.Pyfhel.add
ValueError: encrypted1 and encrypted2 parameter mismatch

Sorry if this is a dump question, it's my first time working with FHE
Anyway, thanks for reading :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions