Struct num_modular::Montgomery
source · pub struct Montgomery<T> { /* private fields */ }
Expand description
A modular reducer based on Montgomery form, only supports odd modulus.
The generic type T represents the underlying integer representation for modular inverse -m^-1 mod R
,
and R=2^B
will be used as the auxiliary modulus, where B is automatically selected
based on the size of T.
Implementations§
Trait Implementations§
source§impl<T: Clone> Clone for Montgomery<T>
impl<T: Clone> Clone for Montgomery<T>
source§fn clone(&self) -> Montgomery<T>
fn clone(&self) -> Montgomery<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for Montgomery<T>
impl<T: Debug> Debug for Montgomery<T>
source§impl Reducer<u128> for Montgomery<u128>
impl Reducer<u128> for Montgomery<u128>
source§impl Reducer<u16> for Montgomery<u16>
impl Reducer<u16> for Montgomery<u16>
source§impl Reducer<u32> for Montgomery<u32>
impl Reducer<u32> for Montgomery<u32>
source§impl Reducer<u64> for Montgomery<u64>
impl Reducer<u64> for Montgomery<u64>
source§impl Reducer<u8> for Montgomery<u8>
impl Reducer<u8> for Montgomery<u8>
source§impl Reducer<usize> for Montgomery<usize>
impl Reducer<usize> for Montgomery<usize>
source§fn inv(&self, target: usize) -> Option<usize>
fn inv(&self, target: usize) -> Option<usize>
Calculate target^-1 mod m in reduced form,
it may return None when there is no modular inverse.
fn add_in_place(&self, lhs: &mut T, rhs: &T)
fn sub_in_place(&self, lhs: &mut T, rhs: &T)
fn mul_in_place(&self, lhs: &mut T, rhs: &T)
impl<T: Copy> Copy for Montgomery<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Montgomery<T>where T: RefUnwindSafe,
impl<T> Send for Montgomery<T>where T: Send,
impl<T> Sync for Montgomery<T>where T: Sync,
impl<T> Unpin for Montgomery<T>where T: Unpin,
impl<T> UnwindSafe for Montgomery<T>where T: UnwindSafe,
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