Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow detected in decrypted number #110

Open
XieFuran opened this issue Apr 11, 2023 · 0 comments
Open

Overflow detected in decrypted number #110

XieFuran opened this issue Apr 11, 2023 · 0 comments

Comments

@XieFuran
Copy link

XieFuran commented Apr 11, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant