Skip to main content

basic_from_montgomery

Function basic_from_montgomery 

Source
pub fn basic_from_montgomery<T>(
    a_mont: T,
    modulus: T,
    n_prime: T,
    r_bits: usize,
) -> T
where T: Copy + Zero + One + PartialOrd + Mul<Output = T> + Add<Output = T> + Sub<Output = T> + Shr<usize, Output = T> + Shl<usize, Output = T> + BitAnd<Output = T>,
Expand description

Convert from Montgomery form (Basic): (a * R) -> a mod N Uses Montgomery reduction algorithm with legacy R > N semantics.

Warning: This function can overflow for large moduli where m * N exceeds the type width. For overflow-free reduction, use wide_from_montgomery which uses wide-REDC with R = 2^W.