Skip to content

Commit e13b060

Browse files
authored
Rename MontgomeryMultiplier => MontyMultiplier (#491)
1 parent ca80b71 commit e13b060

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/modular/boxed_monty_form/mul.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl BoxedMontyForm {
2323
/// Multiplies by `rhs`.
2424
pub fn mul(&self, rhs: &Self) -> Self {
2525
debug_assert_eq!(&self.params, &rhs.params);
26-
let montgomery_form = MontgomeryMultiplier::from(self.params.borrow())
26+
let montgomery_form = MontyMultiplier::from(self.params.borrow())
2727
.mul(&self.montgomery_form, &rhs.montgomery_form);
2828

2929
Self {
@@ -35,7 +35,7 @@ impl BoxedMontyForm {
3535
/// Computes the (reduced) square.
3636
pub fn square(&self) -> Self {
3737
let montgomery_form =
38-
MontgomeryMultiplier::from(self.params.borrow()).square(&self.montgomery_form);
38+
MontyMultiplier::from(self.params.borrow()).square(&self.montgomery_form);
3939

4040
Self {
4141
montgomery_form,
@@ -83,7 +83,7 @@ impl MulAssign<BoxedMontyForm> for BoxedMontyForm {
8383
impl MulAssign<&BoxedMontyForm> for BoxedMontyForm {
8484
fn mul_assign(&mut self, rhs: &BoxedMontyForm) {
8585
debug_assert_eq!(&self.params, &rhs.params);
86-
MontgomeryMultiplier::from(self.params.borrow())
86+
MontyMultiplier::from(self.params.borrow())
8787
.mul_assign(&mut self.montgomery_form, &rhs.montgomery_form);
8888
}
8989
}
@@ -96,24 +96,24 @@ impl Square for BoxedMontyForm {
9696

9797
impl SquareAssign for BoxedMontyForm {
9898
fn square_assign(&mut self) {
99-
MontgomeryMultiplier::from(self.params.borrow()).square_assign(&mut self.montgomery_form);
99+
MontyMultiplier::from(self.params.borrow()).square_assign(&mut self.montgomery_form);
100100
}
101101
}
102102

103-
impl<'a> From<&'a BoxedMontyParams> for MontgomeryMultiplier<'a> {
104-
fn from(params: &'a BoxedMontyParams) -> MontgomeryMultiplier<'a> {
105-
MontgomeryMultiplier::new(&params.modulus, params.mod_neg_inv)
103+
impl<'a> From<&'a BoxedMontyParams> for MontyMultiplier<'a> {
104+
fn from(params: &'a BoxedMontyParams) -> MontyMultiplier<'a> {
105+
MontyMultiplier::new(&params.modulus, params.mod_neg_inv)
106106
}
107107
}
108108

109109
/// Montgomery multiplier with a pre-allocated internal buffer to avoid additional allocations.
110-
pub(super) struct MontgomeryMultiplier<'a> {
110+
pub(super) struct MontyMultiplier<'a> {
111111
product: BoxedUint,
112112
modulus: &'a BoxedUint,
113113
mod_neg_inv: Limb,
114114
}
115115

116-
impl<'a> MontgomeryMultiplier<'a> {
116+
impl<'a> MontyMultiplier<'a> {
117117
/// Create a new Montgomery multiplier.
118118
pub(super) fn new(modulus: &'a BoxedUint, mod_neg_inv: Limb) -> Self {
119119
Self {
@@ -233,7 +233,7 @@ impl<'a> MontgomeryMultiplier<'a> {
233233
}
234234

235235
#[cfg(feature = "zeroize")]
236-
impl Drop for MontgomeryMultiplier<'_> {
236+
impl Drop for MontyMultiplier<'_> {
237237
fn drop(&mut self) {
238238
self.product.zeroize();
239239
}

src/modular/boxed_monty_form/pow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Modular exponentiation support for [`BoxedMontyForm`].
22
3-
use super::{mul::MontgomeryMultiplier, BoxedMontyForm};
3+
use super::{mul::MontyMultiplier, BoxedMontyForm};
44
use crate::{BoxedUint, ConstantTimeSelect, Limb, PowBoundedExp, Word};
55
use alloc::vec::Vec;
66
use subtle::{ConstantTimeEq, ConstantTimeLess};
@@ -59,7 +59,7 @@ fn pow_montgomery_form(
5959
const WINDOW: u32 = 4;
6060
const WINDOW_MASK: Word = (1 << WINDOW) - 1;
6161

62-
let mut multiplier = MontgomeryMultiplier::new(modulus, mod_neg_inv);
62+
let mut multiplier = MontyMultiplier::new(modulus, mod_neg_inv);
6363

6464
// powers[i] contains x^i
6565
let mut powers = Vec::with_capacity(1 << WINDOW);

0 commit comments

Comments
 (0)