Skip to content

Overflow detected in decrypted number #110

@XieFuran

Description

@XieFuran

I have an algorithm that iteratively performs multiple homomorphic multiplications and needs to decrypt once in each iteration. Although the calculation is small, an error will be reported: Overflow detected in decrypted number.

I wrote a test code to describe the problem as below.

from phe import paillier
import random
public_key, private_key = paillier.generate_paillier_keypair(n_length=1024)
x = random.random()
y = random.random()
E_x = public_key.encrypt(x)
iter_k = 100
for i in range(iter_k):
    print("iterations:",i)
    E_x = y*E_x
    private_key.decrypt(E_x)
print(private_key.decrypt(E_x))

I know that increasing the value of n_length can alleviate the problem, but this reduces efficiency and does not eliminate the problem. So, what should I do, thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions