|
9 | 9 |
|
10 | 10 | # 3rd party dependencies
|
11 | 11 | from tqdm import tqdm
|
| 12 | +from lightecc.interfaces.elliptic_curve import EllipticCurvePoint |
| 13 | +from lightecc.forms.weierstrass import Weierstrass |
| 14 | +from lightecc.forms.edwards import TwistedEdwards |
| 15 | +from lightecc.forms.koblitz import Koblitz |
12 | 16 |
|
13 | 17 | # project dependencies
|
14 | 18 | from lightphe.models.Homomorphic import Homomorphic
|
15 | 19 | from lightphe.models.Ciphertext import Ciphertext
|
16 | 20 | from lightphe.models.Algorithm import Algorithm
|
17 | 21 | from lightphe.models.Tensor import Fraction, EncryptedTensor
|
18 |
| -from lightphe.models.EllipticCurve import EllipticCurvePoint |
19 | 22 | from lightphe.commons import phe_utils
|
20 | 23 | from lightphe.commons.logger import Logger
|
21 | 24 |
|
|
29 | 32 | from lightphe.cryptosystems.NaccacheStern import NaccacheStern
|
30 | 33 | from lightphe.cryptosystems.GoldwasserMicali import GoldwasserMicali
|
31 | 34 | from lightphe.cryptosystems.EllipticCurveElGamal import EllipticCurveElGamal
|
32 |
| -from lightphe.elliptic_curve_forms.weierstrass import Weierstrass |
33 |
| -from lightphe.elliptic_curve_forms.edwards import TwistedEdwards |
34 |
| -from lightphe.elliptic_curve_forms.koblitz import Koblitz |
35 | 35 |
|
36 | 36 |
|
37 | 37 | # pylint: disable=eval-used, simplifiable-if-expression, too-few-public-methods
|
@@ -465,44 +465,3 @@ def encrypt_float(
|
465 | 465 | logger.error(f"Exception while running encrypt_float: {str(err)}")
|
466 | 466 | logger.error(traceback.format_exc())
|
467 | 467 | raise err
|
468 |
| - |
469 |
| - |
470 |
| -class ECC: |
471 |
| - __version__ = VERSION |
472 |
| - |
473 |
| - def __init__( |
474 |
| - self, form_name: Optional[str] = None, curve_name: Optional[str] = None |
475 |
| - ): |
476 |
| - """ |
477 |
| - Construct an Elliptic Curve over a finite field (prime or binary) |
478 |
| - Args: |
479 |
| - form_name (str): specifies the form of the elliptic curve. |
480 |
| - Options: 'weierstrass' (default), 'edwards', 'koblitz'. |
481 |
| - curve_name (str): specifies the elliptic curve to use. |
482 |
| - Options: |
483 |
| - - e.g. ed25519, ed448 for edwards form |
484 |
| - - e.g. secp256k1 for weierstrass form |
485 |
| - - e.g. k-409 for koblitz form |
486 |
| - List of all available curves: |
487 |
| - github.com/serengil/LightPHE/blob/master/lightphe/elliptic_curve_forms/README.md |
488 |
| - """ |
489 |
| - if form_name is None or form_name == "weierstrass": |
490 |
| - self.curve = Weierstrass(curve=curve_name) |
491 |
| - elif form_name in "edwards": |
492 |
| - self.curve = TwistedEdwards(curve=curve_name) |
493 |
| - elif form_name in "koblitz": |
494 |
| - self.curve = Koblitz(curve=curve_name) |
495 |
| - else: |
496 |
| - raise ValueError(f"unimplemented curve form - {form_name}") |
497 |
| - |
498 |
| - # base point |
499 |
| - self.G = EllipticCurvePoint(self.curve.G[0], self.curve.G[1], self.curve) |
500 |
| - |
501 |
| - # order of the curve |
502 |
| - self.n = self.curve.n |
503 |
| - |
504 |
| - # point at infinity or neutral / identity element |
505 |
| - self.O = EllipticCurvePoint(self.curve.O[0], self.curve.O[1], self.curve) |
506 |
| - |
507 |
| - # modulo |
508 |
| - self.modulo = self.curve.modulo |
0 commit comments