pub struct BoxedMontyMultiplier<'a> {
product: BoxedUint,
modulus: &'a BoxedUint,
mod_neg_inv: Limb,
}Expand description
Montgomery multiplier with a pre-allocated internal buffer to avoid additional allocations.
Fields§
§product: BoxedUint§modulus: &'a BoxedUint§mod_neg_inv: LimbImplementations§
Source§impl<'a> BoxedMontyMultiplier<'a>
impl<'a> BoxedMontyMultiplier<'a>
Sourcepub(super) fn new(modulus: &'a BoxedUint, mod_neg_inv: Limb) -> Self
pub(super) fn new(modulus: &'a BoxedUint, mod_neg_inv: Limb) -> Self
Create a new Montgomery multiplier.
Sourcepub(super) fn mul_assign(&mut self, a: &mut BoxedUint, b: &BoxedUint)
pub(super) fn mul_assign(&mut self, a: &mut BoxedUint, b: &BoxedUint)
Perform a Montgomery multiplication, assigning a fully reduced result to a.
Sourcepub(super) fn square_assign(&mut self, a: &mut BoxedUint)
pub(super) fn square_assign(&mut self, a: &mut BoxedUint)
Perform a squaring using Montgomery multiplication, assigning a fully reduced result to a.
Sourcepub(super) fn mul_amm_assign(&mut self, a: &mut BoxedUint, b: &BoxedUint)
pub(super) fn mul_amm_assign(&mut self, a: &mut BoxedUint, b: &BoxedUint)
Perform an “Almost Montgomery Multiplication”, assigning the product to a.
NOTE: the resulting output will be reduced to the bit length of the modulus, but not fully reduced and may exceed the modulus. A final reduction is required to ensure AMM results are fully reduced, and should not be exposed outside the internals of this crate.
Sourcepub(super) fn square_amm_assign(&mut self, a: &mut BoxedUint)
pub(super) fn square_amm_assign(&mut self, a: &mut BoxedUint)
Perform a squaring using “Almost Montgomery Multiplication”, assigning the result to a.
NOTE: the resulting output will be reduced to the bit length of the modulus, but not fully reduced and may exceed the modulus. A final reduction is required to ensure AMM results are fully reduced, and should not be exposed outside the internals of this crate.
Trait Implementations§
Source§impl<'a> AmmMultiplier<'a> for BoxedMontyMultiplier<'a>
impl<'a> AmmMultiplier<'a> for BoxedMontyMultiplier<'a>
Source§fn mul_amm_assign(&mut self, a: &mut BoxedUint, b: &BoxedUint)
fn mul_amm_assign(&mut self, a: &mut BoxedUint, b: &BoxedUint)
a.Source§fn square_amm_assign(&mut self, a: &mut BoxedUint)
fn square_amm_assign(&mut self, a: &mut BoxedUint)
a.Source§impl<'a> Clone for BoxedMontyMultiplier<'a>
impl<'a> Clone for BoxedMontyMultiplier<'a>
Source§fn clone(&self) -> BoxedMontyMultiplier<'a>
fn clone(&self) -> BoxedMontyMultiplier<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for BoxedMontyMultiplier<'a>
impl<'a> Debug for BoxedMontyMultiplier<'a>
Source§impl Drop for BoxedMontyMultiplier<'_>
Available on crate feature zeroize only.
impl Drop for BoxedMontyMultiplier<'_>
zeroize only.Source§impl<'a> From<&'a BoxedMontyParams> for BoxedMontyMultiplier<'a>
impl<'a> From<&'a BoxedMontyParams> for BoxedMontyMultiplier<'a>
Source§fn from(params: &'a BoxedMontyParams) -> BoxedMontyMultiplier<'a>
fn from(params: &'a BoxedMontyParams) -> BoxedMontyMultiplier<'a>
Source§impl<'a> MontyMultiplier<'a> for BoxedMontyMultiplier<'a>
impl<'a> MontyMultiplier<'a> for BoxedMontyMultiplier<'a>
Source§fn mul_assign(&mut self, lhs: &mut BoxedMontyForm, rhs: &BoxedMontyForm)
fn mul_assign(&mut self, lhs: &mut BoxedMontyForm, rhs: &BoxedMontyForm)
Performs a Montgomery multiplication, assigning a fully reduced result to lhs.
Source§fn square_assign(&mut self, lhs: &mut BoxedMontyForm)
fn square_assign(&mut self, lhs: &mut BoxedMontyForm)
Performs a Montgomery squaring, assigning a fully reduced result to lhs.