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.
Files changed (47) hide show
  1. {lightphe-0.0.6 → lightphe-0.0.7}/PKG-INFO +1 -1
  2. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/ElGamal.py +9 -2
  3. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/GoldwasserMicali.py +6 -1
  4. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/PKG-INFO +1 -1
  5. {lightphe-0.0.6 → lightphe-0.0.7}/setup.py +1 -1
  6. {lightphe-0.0.6 → lightphe-0.0.7}/LICENSE +0 -0
  7. {lightphe-0.0.6 → lightphe-0.0.7}/README.md +0 -0
  8. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/__init__.py +0 -0
  9. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/commons/__init__.py +0 -0
  10. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/commons/logger.py +0 -0
  11. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/commons/phe_utils.py +0 -0
  12. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/Benaloh.py +0 -0
  13. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/DamgardJurik.py +0 -0
  14. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/EllipticCurveElGamal.py +0 -0
  15. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/NaccacheStern.py +0 -0
  16. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/OkamotoUchiyama.py +0 -0
  17. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/Paillier.py +0 -0
  18. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/RSA.py +0 -0
  19. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/cryptosystems/__init__.py +0 -0
  20. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/elliptic/Weierstrass.py +0 -0
  21. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/elliptic/__init__.py +0 -0
  22. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Algorithm.py +0 -0
  23. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Ciphertext.py +0 -0
  24. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/EllipticCurve.py +0 -0
  25. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Homomorphic.py +0 -0
  26. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/Tensor.py +0 -0
  27. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe/models/__init__.py +0 -0
  28. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/SOURCES.txt +0 -0
  29. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/dependency_links.txt +0 -0
  30. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/requires.txt +0 -0
  31. {lightphe-0.0.6 → lightphe-0.0.7}/lightphe.egg-info/top_level.txt +0 -0
  32. {lightphe-0.0.6 → lightphe-0.0.7}/requirements.txt +0 -0
  33. {lightphe-0.0.6 → lightphe-0.0.7}/setup.cfg +0 -0
  34. {lightphe-0.0.6 → lightphe-0.0.7}/tests/__init__.py +0 -0
  35. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_benaloh.py +0 -0
  36. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_cloud.py +0 -0
  37. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_damgard.py +0 -0
  38. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_elgamal.py +0 -0
  39. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_ellipticcurveelgamal.py +0 -0
  40. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_exporting_keys.py +0 -0
  41. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_goldwasser.py +0 -0
  42. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_naccache.py +0 -0
  43. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_okamoto.py +0 -0
  44. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_paillier.py +0 -0
  45. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_rsa.py +0 -0
  46. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_salary.py +0 -0
  47. {lightphe-0.0.6 → lightphe-0.0.7}/tests/test_tensors.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lightphe
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A Lightweight Partially Homomorphic Encryption Library for Python
5
5
  Home-page: https://github.com/serengil/LightPHE
6
6
  Author: Sefik Ilkin Serengil
@@ -1,7 +1,12 @@
1
+ # built-in dependencies
1
2
  import random
2
- import math
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
- if pow(xp, int((p - 1) / 2), p) == 1 and pow(xq, int((q - 1) / 2), q) == 1:
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")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lightphe
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A Lightweight Partially Homomorphic Encryption Library for Python
5
5
  Home-page: https://github.com/serengil/LightPHE
6
6
  Author: Sefik Ilkin Serengil
@@ -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.6",
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