Skip to content

Commit 6a293f9

Browse files
committed
BoxedUint: rename inv_odd_mod for consistency
1 parent 6d313f8 commit 6a293f9

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/uint/boxed/inv_mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ use crate::{
77
use subtle::{Choice, ConstantTimeEq, ConstantTimeLess, CtOption};
88

99
impl BoxedUint {
10-
/// Computes the multiplicative inverse of `self` mod `modulus`.
11-
/// Returns `None` if an inverse does not exist.
12-
pub fn inv_mod(&self, modulus: &Odd<Self>) -> CtOption<Self> {
10+
/// Computes the multiplicative inverse of `self` mod `modulus`, where `modulus` is odd.
11+
pub fn inv_odd_mod(&self, modulus: &Odd<Self>) -> CtOption<Self> {
1312
modulus.precompute_inverter().invert(self)
1413
}
1514

src/uint/inv_mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ impl<const LIMBS: usize> Uint<LIMBS> {
8181
}
8282

8383
/// Computes the multiplicative inverse of `self` mod `modulus`, where `modulus` is odd.
84-
/// Returns `(inverse, ConstChoice::TRUE)` if an inverse exists,
85-
/// otherwise `(undefined, ConstChoice::FALSE)`.
8684
pub const fn inv_odd_mod<const UNSAT_LIMBS: usize>(
8785
&self,
8886
modulus: &Odd<Self>,

tests/boxed_uint_proptests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ proptest! {
169169
let a_bi = to_biguint(&a);
170170
let b_bi = to_biguint(&b);
171171
let expected = a_bi.mod_inverse(b_bi);
172-
let actual = Option::from(a.inv_mod(&b));
172+
let actual = Option::from(a.inv_odd_mod(&b));
173173

174174
match (expected, actual) {
175175
(Some(exp), Some(act)) => prop_assert_eq!(exp, to_biguint(&act).into()),

0 commit comments

Comments
 (0)