lightphe 0.0.6__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lightphe-0.0.6 → lightphe-0.0.7}/PKG-INFO +1 -1
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/ElGamal.py +9 -2
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/GoldwasserMicali.py +6 -1
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/PKG-INFO +1 -1
- {lightphe-0.0.6 → lightphe-0.0.7}/setup.py +1 -1
- {lightphe-0.0.6 → lightphe-0.0.7}/LICENSE +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/README.md +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/__init__.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/commons/__init__.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/commons/logger.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/commons/phe_utils.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/Benaloh.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/DamgardJurik.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/EllipticCurveElGamal.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/NaccacheStern.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/OkamotoUchiyama.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/Paillier.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/RSA.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/__init__.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/elliptic/Weierstrass.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/elliptic/__init__.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Algorithm.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Ciphertext.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/EllipticCurve.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Homomorphic.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Tensor.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/__init__.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/SOURCES.txt +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/dependency_links.txt +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/requires.txt +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/top_level.txt +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/requirements.txt +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/setup.cfg +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/__init__.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_benaloh.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_cloud.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_damgard.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_elgamal.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_ellipticcurveelgamal.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_exporting_keys.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_goldwasser.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_naccache.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_okamoto.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_paillier.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_rsa.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_salary.py +0 -0
- {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_tensors.py +0 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
# built-in dependencies
|
|
1
2
|
import random
|
|
2
|
-
import
|
|
3
|
+
import decimal
|
|
3
4
|
from typing import Optional
|
|
5
|
+
|
|
6
|
+
# 3rd party dependencies
|
|
4
7
|
import sympy
|
|
8
|
+
|
|
9
|
+
# project dependencies
|
|
5
10
|
from lightphe.models.Homomorphic import Homomorphic
|
|
6
11
|
from lightphe.commons.logger import Logger
|
|
7
12
|
|
|
@@ -45,7 +50,9 @@ class ElGamal(Homomorphic):
|
|
|
45
50
|
p = sympy.randprime(100, 2 ** int(key_size / 2) - 1)
|
|
46
51
|
|
|
47
52
|
# picking a generator g
|
|
48
|
-
g = random.randint(2, int(math.sqrt(p)))
|
|
53
|
+
# g = random.randint(2, int(math.sqrt(p))) # reaches int limit for 3072-bit key
|
|
54
|
+
# g = int(random.uniform(2, float(decimal.Decimal(p).sqrt())))
|
|
55
|
+
g = random.randint(2, int(decimal.Decimal(p).sqrt()))
|
|
49
56
|
|
|
50
57
|
# picking a private key x
|
|
51
58
|
x = random.randint(1, p - 2)
|
|
@@ -128,7 +128,12 @@ class GoldwasserMicali(Homomorphic):
|
|
|
128
128
|
xp = i % p
|
|
129
129
|
xq = i % q
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
# reaches int limit for 3072-bit key
|
|
132
|
+
# if pow(xp, int((p - 1) / 2), p) == 1 and pow(xq, int((q - 1) / 2), q) == 1:
|
|
133
|
+
if (
|
|
134
|
+
pow(xp, int((p - 1) // 2), p) == 1
|
|
135
|
+
and pow(xq, int((q - 1) // 2), q) == 1
|
|
136
|
+
):
|
|
132
137
|
m_binaries.append("0")
|
|
133
138
|
else:
|
|
134
139
|
m_binaries.append("1")
|
|
@@ -8,7 +8,7 @@ with open("requirements.txt", "r", encoding="utf-8") as f:
|
|
|
8
8
|
|
|
9
9
|
setuptools.setup(
|
|
10
10
|
name="lightphe",
|
|
11
|
-
version="0.0.
|
|
11
|
+
version="0.0.7",
|
|
12
12
|
author="Sefik Ilkin Serengil",
|
|
13
13
|
author_email="serengil@gmail.com",
|
|
14
14
|
description="A Lightweight Partially Homomorphic Encryption Library for Python",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|