Struct crypto_bigint::modular::BoxedMontyForm
source · pub struct BoxedMontyForm { /* private fields */ }
alloc
only.Expand description
An integer in Montgomery form represented using heap-allocated limbs.
Implementations§
source§impl BoxedMontyForm
impl BoxedMontyForm
sourcepub fn pow_bounded_exp(&self, exponent: &BoxedUint, exponent_bits: u32) -> Self
pub fn pow_bounded_exp(&self, exponent: &BoxedUint, exponent_bits: u32) -> Self
Raises to the exponent
power,
with exponent_bits
representing the number of (least significant) bits
to take into account for the exponent.
NOTE: exponent_bits
may be leaked in the time pattern.
source§impl BoxedMontyForm
impl BoxedMontyForm
sourcepub fn new(integer: BoxedUint, params: BoxedMontyParams) -> Self
pub fn new(integer: BoxedUint, params: BoxedMontyParams) -> Self
Instantiates a new BoxedMontyForm
that represents an integer modulo the provided params.
sourcepub fn new_with_arc(integer: BoxedUint, params: Arc<BoxedMontyParams>) -> Self
Available on crate feature std
only.
pub fn new_with_arc(integer: BoxedUint, params: Arc<BoxedMontyParams>) -> Self
std
only.Instantiates a new BoxedMontyForm
that represents an integer modulo the provided params.
sourcepub fn bits_precision(&self) -> u32
pub fn bits_precision(&self) -> u32
Bits of precision in the modulus.
sourcepub fn retrieve(&self) -> BoxedUint
pub fn retrieve(&self) -> BoxedUint
Retrieves the integer currently encoded in this BoxedMontyForm
, guaranteed to be reduced.
sourcepub fn zero(params: BoxedMontyParams) -> Self
pub fn zero(params: BoxedMontyParams) -> Self
Instantiates a new ConstMontyForm
that represents zero.
sourcepub fn one(params: BoxedMontyParams) -> Self
pub fn one(params: BoxedMontyParams) -> Self
Instantiates a new ConstMontyForm
that represents 1.
sourcepub fn params(&self) -> &BoxedMontyParams
pub fn params(&self) -> &BoxedMontyParams
Returns the parameter struct used to initialize this object.
sourcepub fn as_montgomery(&self) -> &BoxedUint
pub fn as_montgomery(&self) -> &BoxedUint
Access the BoxedMontyForm
value in Montgomery form.
sourcepub fn from_montgomery(integer: BoxedUint, params: BoxedMontyParams) -> Self
pub fn from_montgomery(integer: BoxedUint, params: BoxedMontyParams) -> Self
Create a BoxedMontyForm
from a value in Montgomery form.
sourcepub fn to_montgomery(&self) -> BoxedUint
pub fn to_montgomery(&self) -> BoxedUint
Extract the value from the BoxedMontyForm
in Montgomery form.
Trait Implementations§
source§impl Add<&BoxedMontyForm> for &BoxedMontyForm
impl Add<&BoxedMontyForm> for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
+
operator.source§fn add(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
fn add(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
+
operation. Read moresource§impl Add<&BoxedMontyForm> for BoxedMontyForm
impl Add<&BoxedMontyForm> for BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
+
operator.source§fn add(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
fn add(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
+
operation. Read moresource§impl Add<BoxedMontyForm> for &BoxedMontyForm
impl Add<BoxedMontyForm> for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
+
operator.source§fn add(self, rhs: BoxedMontyForm) -> BoxedMontyForm
fn add(self, rhs: BoxedMontyForm) -> BoxedMontyForm
+
operation. Read moresource§impl Add for BoxedMontyForm
impl Add for BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
+
operator.source§fn add(self, rhs: BoxedMontyForm) -> BoxedMontyForm
fn add(self, rhs: BoxedMontyForm) -> BoxedMontyForm
+
operation. Read moresource§impl AddAssign<&BoxedMontyForm> for BoxedMontyForm
impl AddAssign<&BoxedMontyForm> for BoxedMontyForm
source§fn add_assign(&mut self, rhs: &BoxedMontyForm)
fn add_assign(&mut self, rhs: &BoxedMontyForm)
+=
operation. Read moresource§impl AddAssign for BoxedMontyForm
impl AddAssign for BoxedMontyForm
source§fn add_assign(&mut self, rhs: BoxedMontyForm)
fn add_assign(&mut self, rhs: BoxedMontyForm)
+=
operation. Read moresource§impl Clone for BoxedMontyForm
impl Clone for BoxedMontyForm
source§fn clone(&self) -> BoxedMontyForm
fn clone(&self) -> BoxedMontyForm
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BoxedMontyForm
impl Debug for BoxedMontyForm
source§impl Invert for BoxedMontyForm
impl Invert for BoxedMontyForm
source§impl Monty for BoxedMontyForm
impl Monty for BoxedMontyForm
§type Params = BoxedMontyParams
type Params = BoxedMontyParams
source§fn new_params_vartime(modulus: Odd<Self::Integer>) -> Self::Params
fn new_params_vartime(modulus: Odd<Self::Integer>) -> Self::Params
modulus
,
variable time in modulus
.source§fn new(value: Self::Integer, params: Self::Params) -> Self
fn new(value: Self::Integer, params: Self::Params) -> Self
source§fn params(&self) -> &Self::Params
fn params(&self) -> &Self::Params
source§fn as_montgomery(&self) -> &Self::Integer
fn as_montgomery(&self) -> &Self::Integer
source§impl Mul<&BoxedMontyForm> for &BoxedMontyForm
impl Mul<&BoxedMontyForm> for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
*
operator.source§fn mul(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
fn mul(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
*
operation. Read moresource§impl Mul<&BoxedMontyForm> for BoxedMontyForm
impl Mul<&BoxedMontyForm> for BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
*
operator.source§fn mul(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
fn mul(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
*
operation. Read moresource§impl Mul<BoxedMontyForm> for &BoxedMontyForm
impl Mul<BoxedMontyForm> for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
*
operator.source§fn mul(self, rhs: BoxedMontyForm) -> BoxedMontyForm
fn mul(self, rhs: BoxedMontyForm) -> BoxedMontyForm
*
operation. Read moresource§impl Mul for BoxedMontyForm
impl Mul for BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
*
operator.source§fn mul(self, rhs: BoxedMontyForm) -> BoxedMontyForm
fn mul(self, rhs: BoxedMontyForm) -> BoxedMontyForm
*
operation. Read moresource§impl MulAssign<&BoxedMontyForm> for BoxedMontyForm
impl MulAssign<&BoxedMontyForm> for BoxedMontyForm
source§fn mul_assign(&mut self, rhs: &BoxedMontyForm)
fn mul_assign(&mut self, rhs: &BoxedMontyForm)
*=
operation. Read moresource§impl MulAssign for BoxedMontyForm
impl MulAssign for BoxedMontyForm
source§fn mul_assign(&mut self, rhs: BoxedMontyForm)
fn mul_assign(&mut self, rhs: BoxedMontyForm)
*=
operation. Read moresource§impl Neg for &BoxedMontyForm
impl Neg for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
-
operator.source§fn neg(self) -> BoxedMontyForm
fn neg(self) -> BoxedMontyForm
-
operation. Read moresource§impl Neg for BoxedMontyForm
impl Neg for BoxedMontyForm
source§impl PartialEq for BoxedMontyForm
impl PartialEq for BoxedMontyForm
source§fn eq(&self, other: &BoxedMontyForm) -> bool
fn eq(&self, other: &BoxedMontyForm) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PowBoundedExp<BoxedUint> for BoxedMontyForm
impl PowBoundedExp<BoxedUint> for BoxedMontyForm
source§impl Retrieve for BoxedMontyForm
impl Retrieve for BoxedMontyForm
source§impl Square for BoxedMontyForm
impl Square for BoxedMontyForm
source§impl SquareAssign for BoxedMontyForm
impl SquareAssign for BoxedMontyForm
source§fn square_assign(&mut self)
fn square_assign(&mut self)
self * self
, but may be more efficient.
Writes the result in self
.source§impl Sub<&BoxedMontyForm> for &BoxedMontyForm
impl Sub<&BoxedMontyForm> for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
-
operator.source§fn sub(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
fn sub(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
-
operation. Read moresource§impl Sub<&BoxedMontyForm> for BoxedMontyForm
impl Sub<&BoxedMontyForm> for BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
-
operator.source§fn sub(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
fn sub(self, rhs: &BoxedMontyForm) -> BoxedMontyForm
-
operation. Read moresource§impl Sub<BoxedMontyForm> for &BoxedMontyForm
impl Sub<BoxedMontyForm> for &BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
-
operator.source§fn sub(self, rhs: BoxedMontyForm) -> BoxedMontyForm
fn sub(self, rhs: BoxedMontyForm) -> BoxedMontyForm
-
operation. Read moresource§impl Sub for BoxedMontyForm
impl Sub for BoxedMontyForm
§type Output = BoxedMontyForm
type Output = BoxedMontyForm
-
operator.source§fn sub(self, rhs: BoxedMontyForm) -> BoxedMontyForm
fn sub(self, rhs: BoxedMontyForm) -> BoxedMontyForm
-
operation. Read moresource§impl SubAssign<&BoxedMontyForm> for BoxedMontyForm
impl SubAssign<&BoxedMontyForm> for BoxedMontyForm
source§fn sub_assign(&mut self, rhs: &BoxedMontyForm)
fn sub_assign(&mut self, rhs: &BoxedMontyForm)
-=
operation. Read moresource§impl SubAssign for BoxedMontyForm
impl SubAssign for BoxedMontyForm
source§fn sub_assign(&mut self, rhs: BoxedMontyForm)
fn sub_assign(&mut self, rhs: BoxedMontyForm)
-=
operation. Read more