commit f39afeacb8a83a76fe7b6f02e4f90a6e658f364c parent cec3201ca74a71f80c8f2f7477e0fcb672764109 Author: Shivakumar <[email protected]> Date: Mon, 9 Jun 2025 00:01:37 +0530 make field.py and initilize the package Diffstat:
| A | ecc/__init__.py | | | 3 | +++ |
| A | ecc/field.py | | | 9 | +++++++++ |
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/ecc/__init__.py b/ecc/__init__.py @@ -0,0 +1,3 @@ + + + diff --git a/ecc/field.py b/ecc/field.py @@ -0,0 +1,9 @@ +class FieldElement: + + def __init__(self, num: int, prime: int): + + if num >= prime or num < 0: + raise ValueError(f"{num} is not in Filed range 0 to {prime-1}") + + self.num = num + self.prime = prime