diff --git a/src/math/gallois.rs b/src/math/gallois.rs
index 7dd9a83..3709c31 100644
--- a/src/math/gallois.rs
+++ b/src/math/gallois.rs
@@ -15,7 +15,7 @@
/// License: MIT
/// Source:
-use crate::{math::modexp, cplex::printing::seperator, math::modred::modred};
+use crate::{math::modexp::{self, modular_exponentiation_wrapper}, cplex::printing::seperator, math::modred::modred};
use core::fmt;
@@ -379,6 +379,19 @@ impl GalloisField {
self.cha = i;
return i;
}
+
+ /// calculate the order of a element
+ pub fn calc_ord(self, n: u128) -> Option {
+ if n == 0 {
+ return None;
+ }
+ for ord in 2..self.base {
+ if self.pow(n, ord) == 1 {
+ return Some(ord);
+ }
+ }
+ panic!("No order was found, but n is not 0 and all possibilities have been tried");
+ }
}
#[pymethods]