Skip to content

Commit

Permalink
use non zero modulus
Browse files Browse the repository at this point in the history
function sig adjusted to `mult_mod`
  • Loading branch information
shramee committed May 15, 2024
1 parent c76f71e commit 98be42c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/math/src/mod_arithmetics.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ pub fn u256_wide_sqr(a: u256) -> u512 nopanic {
/// # Returns
/// * `u256` - result of modular multiplication
#[inline(always)]
pub fn sqr_mod(a: u256, modulo: u256) -> u256 {
pub fn sqr_mod(a: u256, mod_non_zero: NonZero<u256>) -> u256 {
let mult: u512 = u256_wide_sqr(a);
let mod_non_zero: NonZero<u256> = modulo.try_into().unwrap();
let (_, rem_u256) = u512_safe_div_rem_by_u256(mult, mod_non_zero);
rem_u256
}
Expand Down

0 comments on commit 98be42c

Please sign in to comment.