Created
February 12, 2022 10:15
-
-
Save enigbe/05c233830819c1c045a9ad270fcae93e to your computer and use it in GitHub Desktop.
Finite field element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FiniteFieldElement: | |
"""An element belonging to a finite set""" | |
def __init__(self, eleemnt: int, order: int) -> "FieldElement": | |
""" | |
Initializes a FiniteElement | |
Args: | |
element (int): a number belonging to the set, e.g. 5 | |
order (int): depicting the size of the set e.g 7 | |
Returns: | |
FieldElement | |
""" | |
if element >= order or num < 0: | |
error = f'Element {element} not in the finite field range of 0 to {order - 1}' | |
raise ValueError(error) | |
self.element = element | |
self.order = order |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment