pub struct ModularArithmetic {
pub modulus: u64,
}Expand description
Modular arithmetic helpers with support for common field operations.
§WARNING
Educational implementation only.
Fields§
§modulus: u64The modulus
Implementations§
Source§impl ModularArithmetic
impl ModularArithmetic
Sourcepub fn new(modulus: u64) -> Self
pub fn new(modulus: u64) -> Self
Create a new modular arithmetic context with the given modulus.
Sourcepub fn pow(&self, a: u64, e: u64) -> u64
pub fn pow(&self, a: u64, e: u64) -> u64
Fast exponentiation a^e mod p using repeated squaring.
Auto Trait Implementations§
impl Freeze for ModularArithmetic
impl RefUnwindSafe for ModularArithmetic
impl Send for ModularArithmetic
impl Sync for ModularArithmetic
impl Unpin for ModularArithmetic
impl UnsafeUnpin for ModularArithmetic
impl UnwindSafe for ModularArithmetic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more