#modulo #montgomery

no-std modulo-n-tools

modulo tools

3 unstable releases

0.2.0 Aug 4, 2021
0.1.1 May 1, 2021
0.1.0 Mar 27, 2021

#673 in Math

Download history 37/week @ 2022-06-08 34/week @ 2022-06-15 34/week @ 2022-06-22 36/week @ 2022-06-29 40/week @ 2022-07-06 39/week @ 2022-07-13 38/week @ 2022-07-20 40/week @ 2022-07-27 38/week @ 2022-08-03 40/week @ 2022-08-10 37/week @ 2022-08-17 40/week @ 2022-08-24 38/week @ 2022-08-31 41/week @ 2022-09-07 44/week @ 2022-09-14 42/week @ 2022-09-21

170 downloads per month
Used in 2 crates

AGPL-3.0-or-later

12KB
287 lines

modulo_tools

add, sub, mul, pow in modulo, Montgomery multiplication.

use modulo_n_tools::*;
use modulo_n_tools::montgomery::*;
let a = add_mod(&3, &4, &5);
assert_eq!(a, 2);
let b = mul_mod(&3, &a, &5);
assert_eq!(b, 1);
let c = pow_mod(2, 6, &7);
assert_eq!(c, 1);
let m = Montgomery64::new(57);
let d = m.powmod(5, 42);
assert_eq!(d, 7);

Licence

AGPL-3.0-or-later


lib.rs:

modulo_tools

use modulo_n_tools::*;
use modulo_n_tools::montgomery::*;
let a = add_mod(&3, &4, &5);
assert_eq!(a, 2);
let b = mul_mod(&3, &a, &5);
assert_eq!(b, 1);
let c = pow_mod(2, 6, &7);
assert_eq!(c, 1);
let m = Montgomery64::new(57);
let d = m.powmod(5, 42);
assert_eq!(d, 7);

No runtime deps