ecc

Elliptic Curve Cryptograpy library from scratch in python.
Log | Files | Refs | README | LICENSE

commit 5fb92581982b944ad46f8691fd800140455fb96a
parent 2b9bbc683dbb921a63f83ac0ab3b152f331ea9fe
Author: Shivakumar <[email protected]>
Date:   Mon,  9 Jun 2025 00:06:37 +0530

add exponentiation operation using Fermat's Little Theorem

Diffstat:
Mecc/field.py | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/ecc/field.py b/ecc/field.py @@ -31,3 +31,16 @@ class FieldElement: raise TypeError("Can not multiply the elements of different Field.") return FieldElement((self.num * other.num) % self.prime, self.prime) + + + def __pow__(self, exponent: int): + + exponent = exponent % (self.prime - 1) + return FieldElement(pow(self.num, self.exponet, self.prime), self.prime) + + + def __repr__(self): + + return f"F_({self.prime}({self.num}))" + +