Member-only story
Partial Homomorphic Encryption (PHE)
We are now moving into a world of Fully Homomorphic Encryption (FHE). This will typically use lattice-based methods. But, it can still be a little slow and also can suffer from too much noise when we multiply vectors which have a small error. Basically, we have the operation of:
and where we can replace the circle with any mathematical operation. But, if we do not need FHE, we can implement Partially Homomorphic Encryption (PHE). They include RSA, ElGamal, Exponential ElGamal, Elliptic Curve ElGamal, Paillier, Damgard-Jurik, Okamoto–Uchiyama, Benaloh, Naccache–Stern, and Goldwasser–Micali. A simple program to cipher each of these values is [here]:
from lightphe import LightPHE
import sys
import io
import pytest
algorithms = [
"RSA",
"ElGamal",
"Exponential-ElGamal",
"Paillier",
"Damgard-Jurik",
"Okamoto-Uchiyama",
"Benaloh",
"Naccache-Stern",
"Goldwasser-Micali",
"EllipticCurve-ElGamal"
]
hom_type="RSA"
a = 13
b = 17
if (len(sys.argv)>1):
hom_type=str(sys.argv[1])
if (len(sys.argv)>2):
a=int(sys.argv[2])
if (len(sys.argv)>3):
b=int(sys.argv[3])
print(f"Method: {hom_type}")
print(f"a: {a}")
print(f"b: {b}\n")
cs = LightPHE(algorithm_name = hom_type)
a1 = cs.encrypt(a)
b1 = cs.encrypt(b)
print(f"\n== Try addition for {hom_type}==\n")
try:
c=a1+b1
dec=cs.decrypt(c)
print(f"Cipher: {c}")…