我希望对加密的值执行算术运算,这些值将解密为解密值的结果。有人知道正在使用的代码示例吗?使用这个等式会很好,因为下面的链接中的well.The psuedo相当模糊。
如此理想地给出了v1和v2
v1 =5,v2 = 4;
解密(v1Encrypted+ v2Encrypted) = 9;
发布于 2018-08-10 14:09:54
您可以使用Python中的同态加密库皮弗精确地做到这一点。只需使用pip install Pyfhel安装它并创建一个简单的演示:
from Pyfhel import Pyfhel, PyCtxt
he = Pyfhel() # Object in charge of all homomorphic operations
he.contextGen(10000) # Choose the maximum size of your integers
he.keyGen(10000) # Generate your private/public key pair
# Now to the encryption/operation/decryption
v1 = 5
v2 = 4
p1 = he.encrypt(v1)
p2 = he.encrypt(v2)
p3 = p1 + p2
he.decrypt(p3)
#> 9https://stackoverflow.com/questions/46501956
复制相似问题