We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba54933 commit 223ad5eCopy full SHA for 223ad5e
Cargo.lock
Cargo.toml
@@ -32,8 +32,10 @@ zeroize = { version = "1", optional = true, default-features = false }
32
bincode = "1"
33
criterion = { version = "0.5", features = ["html_reports"] }
34
hex-literal = "0.4"
35
-num-bigint = { package = "num-bigint-dig", version = "0.8" }
+num-bigint-dig = "0.8"
36
+num-bigint = "0.4"
37
num-integer = "0.1"
38
+num-modular = { version = "0.5", features = ["num-bigint"] }
39
proptest = "1"
40
rand_core = { version = "0.6", features = ["std"] }
41
rand_chacha = "0.3"
benches/boxed_monty.rs
@@ -6,7 +6,7 @@ use crypto_bigint::{
6
modular::{BoxedMontyForm, BoxedMontyParams},
7
BoxedUint, NonZero, Odd, RandomMod,
8
};
9
-use num_bigint::BigUint;
+use num_bigint_dig::BigUint;
10
use rand_core::OsRng;
11
12
/// Size of `BoxedUint` to use in benchmark.
tests/boxed_monty_form.rs
@@ -6,7 +6,8 @@ use crypto_bigint::{
BoxedUint, Integer, Inverter, Limb, NonZero, Odd, PrecomputeInverter,
-use num_bigint::{BigUint, ModInverse};
+use num_bigint::BigUint;
+use num_modular::ModularUnaryOps;
use proptest::prelude::*;
use std::cmp::Ordering;
13
@@ -84,7 +85,7 @@ proptest! {
84
85
86
let x_bi = retrieve_biguint(&x);
87
let n_bi = to_biguint(n.modulus());
- let expected = x_bi.mod_inverse(&n_bi);
88
+ let expected = x_bi.invm(&n_bi);
89
90
match (expected, actual) {
91
(Some(exp), Some(act)) => prop_assert_eq!(exp, to_biguint(&act).into()),
@@ -101,7 +102,7 @@ proptest! {
101
102
103
104
105
106
107
108
(Some(exp), Some(act)) => {
tests/boxed_uint_proptests.rs
@@ -4,8 +4,9 @@
4
5
use core::cmp::Ordering;
use crypto_bigint::{BoxedUint, CheckedAdd, Integer, Limb, NonZero};
use num_integer::Integer as _;
use num_traits::identities::One;
@@ -170,7 +171,7 @@ proptest! {
170
171
172
let a_bi = to_biguint(&a);
173
let b_bi = to_biguint(&b);
- let expected = a_bi.mod_inverse(b_bi);
174
+ let expected = a_bi.invm(&b_bi);
175
let actual = Option::from(a.inv_mod(&b));
176
177
tests/const_monty_form.rs
@@ -1,7 +1,8 @@
1
//! Equivalence tests between `crypto_bigint::ConstMontyForm` and `num-bigint`.
2
3
use crypto_bigint::{impl_modulus, modular::ConstMontyParams, Encoding, Invert, Inverter, U256};
impl_modulus!(
@@ -38,7 +39,7 @@ proptest! {
let n_bi = to_biguint(&Modulus::MODULUS);
42
43
44
45
@@ -59,7 +60,7 @@ proptest! {
59
60
61
62
63
64
65
66
tests/monty_form.rs
//! Equivalence tests between `crypto_bigint::MontyForm` and `num-bigint`.
use crypto_bigint::{Encoding, Integer, Invert, Inverter, NonZero, Odd, PrecomputeInverter, U256};
type MontyForm = crypto_bigint::modular::MontyForm<{ U256::LIMBS }>;
@@ -45,7 +46,7 @@ proptest! {
46
47
48
49
50
51
52
@@ -66,7 +67,7 @@ proptest! {
67
68
69
70
71
72
73
0 commit comments