commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
38df76241f943e70951c3a814abfabc9ac965dd3
Arthur Gautier
2025-05-23T13:44:41
impl `to_be_bytes_trimmed` and `to_le_bytes_trimmed` for `BoxedUint` (#824) This helpers strips the leading zeroes from the serialization. See: - https://github.com/RustCrypto/RSA/pull/519 - https://github.com/RustCrypto/RSA/issues/518
diff --git a/src/uint/boxed/encoding.rs b/src/uint/boxed/encoding.rs index 00aa212..0d7255a 100644 --- a/src/uint/boxed/encoding.rs +++ b/src/uint/boxed/encoding.rs @@ -90,6 +90,14 @@ impl BoxedUint { out.into() } + /// Serialize this [`BoxedUint`] as big-endian without leading zeroes. + #[inline]...
1
69
0
7b65b7472ac36971ebe6afc48e0db220abd8b687
Arthur Gautier
2025-05-23T01:15:27
BoxedUint: fixup `to_le_bytes` test (#825)
diff --git a/src/uint/boxed/encoding.rs b/src/uint/boxed/encoding.rs index 85d7b0e..00aa212 100644 --- a/src/uint/boxed/encoding.rs +++ b/src/uint/boxed/encoding.rs @@ -428,8 +428,8 @@ mod tests { #[test] fn to_le_bytes() { let bytes = hex!("ffeeddccbbaa99887766554433221100"); - let n = BoxedU...
1
2
2
cc628096387796043360fe5d18d07d00f18bc820
Arthur Gautier
2025-05-15T17:19:26
implement `From<Odd> for NonZero` (#821)
diff --git a/src/non_zero.rs b/src/non_zero.rs index e76b5b9..46f54f0 100644 --- a/src/non_zero.rs +++ b/src/non_zero.rs @@ -1,6 +1,6 @@ //! Wrapper type for non-zero integers. -use crate::{Bounded, ConstChoice, Constants, Encoding, Int, Limb, Uint, Zero}; +use crate::{Bounded, ConstChoice, Constants, Encoding, Int,...
1
7
1
354719b3afb44ac23345b5a6f2232989711b16d0
Tony Arcieri
2025-05-11T13:16:21
v0.7.0-pre.3 (#819)
diff --git a/Cargo.lock b/Cargo.lock index c9231b0..f5f41cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-bigint" -version = "0.7.0-pre.2" +version = "0.7.0-pre.3" dependencies = [ "bincode", ...
2
2
2
0ce63e91d1b6eee0175eebffcf0328bbbfdf779b
Tony Arcieri
2025-05-06T21:50:49
Have `impl_modulus!` reference itself by `$crate::` (#818) This avoids the requirement to have it in scope
diff --git a/src/modular/const_monty_form/macros.rs b/src/modular/const_monty_form/macros.rs index 9215fc4..4c2e784 100644 --- a/src/modular/const_monty_form/macros.rs +++ b/src/modular/const_monty_form/macros.rs @@ -13,7 +13,7 @@ #[macro_export] macro_rules! impl_modulus { ($name:ident, $uint_type:ty, $value:ex...
1
1
1
b973447e001c8938178a07fc73f620fc02e98934
Tony Arcieri
2025-05-01T03:40:29
v0.7.0-pre.2 (#815)
diff --git a/Cargo.lock b/Cargo.lock index fe9072f..c9231b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-bigint" -version = "0.7.0-pre.1" +version = "0.7.0-pre.2" dependencies = [ "bincode", ...
2
2
2
af8197c123653970152bbc2ab727f6ba6d731884
Tony Arcieri
2025-05-01T03:30:37
Remove `Invert` trait bounds and add default `invert_vartime` (#814) These changes will allow the trait to act as a drop-in replacement for the `Invert` trait in the `elliptic-curve` crate.
diff --git a/src/traits.rs b/src/traits.rs index f20ca6c..a9e75c3 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -807,7 +807,7 @@ where } /// Constant-time inversion. -pub trait Invert: Sized { +pub trait Invert { /// Output of the inversion. type Output; @@ -815,7 +815,9 @@ pub trait Invert: Sized {...
1
4
2
b92832fbbf62192eea54a456dc4174bf4f99ac2b
Tony Arcieri
2025-04-29T21:43:09
Remove `UintRef` from public API (#812) This type might need some time to bake before we're ready to expose it to end users. For now, this keeps it a hidden implementation detail until we're sure we're ready for it to be part of the public API.
diff --git a/src/uint.rs b/src/uint.rs index d88e9a9..7fa9b78 100644 --- a/src/uint.rs +++ b/src/uint.rs @@ -13,7 +13,7 @@ use zeroize::DefaultIsZeroes; #[cfg(feature = "extra-sizes")] pub use extra_sizes::*; -pub use ref_type::UintRef; +pub(crate) use ref_type::UintRef; use crate::{ Bounded, ConstCtOption,...
3
25
17
cd2ccf3878739ecf9f2eb0b035587987c5f4dc47
Bogdan Opanchuk
2025-04-27T13:52:58
More convenience methods for boxed integer resizing (#809) This PR attempts to simplify some scenarios that were encountered during the work on https://github.com/RustCrypto/RSA/pull/506. - Instead of having `BoxedUint::shorten()`/`widen()` methods, introduce the `Resize` trait with more convenience methods. Implemen...
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index 9f63557..6ea411e 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -11,7 +11,7 @@ mod sub; use super::{ConstMontyParams, Retrieve, div_by_2}; use mul::BoxedMontyMultiplier; -use crate::{BoxedUint...
12
151
61
3f21087dbd15440031b6a0ee7ae8b787603114f5
Bogdan Opanchuk
2025-04-24T17:53:42
Keep `BoxedMontyParams` in an `Arc` (#808) Fixes #804
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index 1ee2abc..9f63557 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -21,7 +21,10 @@ use zeroize::Zeroize; /// Parameters to efficiently go to/from the Montgomery form for an odd modulus whose size an...
8
84
67
7cfcd374dcf4c7f6f2ebccd05f41e9496f2e6f20
Tony Arcieri
2025-04-24T12:32:50
Add `UintRef` (#806) Adds a reference newtype for a `Limb` slice which can be used as an abstraction for implementing shared functionality for both `Uint` and `BoxedUint`. The initial implementation supports a limited amount of functionality but supports usage as both `&UintRef` and `&mut UintRef`. This includes a c...
diff --git a/src/uint.rs b/src/uint.rs index 5802d75..d88e9a9 100644 --- a/src/uint.rs +++ b/src/uint.rs @@ -13,6 +13,8 @@ use zeroize::DefaultIsZeroes; #[cfg(feature = "extra-sizes")] pub use extra_sizes::*; +pub use ref_type::UintRef; + use crate::{ Bounded, ConstCtOption, ConstZero, Constants, Encoding, Fi...
3
215
69
51cb9afa4e8173b2c2992efdf17352e8b91331e8
Tony Arcieri
2025-04-23T21:22:38
Rename `as_(limbs|words)_mut` => `as_mut_(limbs|words)` (#805) This better follows Rust conventions like `as_mut_slice`, where the ordering is like Rust's `mut T`. The old names are retained, but deprecated.
diff --git a/src/int.rs b/src/int.rs index 553529d..a964cc8 100644 --- a/src/int.rs +++ b/src/int.rs @@ -109,8 +109,14 @@ impl<const LIMBS: usize> Int<LIMBS> { } /// Borrow the inner limbs as a mutable array of [`Word`]s. - pub fn as_words_mut(&mut self) -> &mut [Word; LIMBS] { - self.0.as_words_m...
8
62
26
c7889598ac12d55070399f259f38f1eb25da5b5d
Tony Arcieri
2025-04-20T20:57:58
v0.7.0-pre.1 (#802)
diff --git a/Cargo.lock b/Cargo.lock index b4c7533..fbc463c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-bigint" -version = "0.7.0-pre.0" +version = "0.7.0-pre.1" dependencies = [ "bincode", ...
2
2
2
e97beae6593c30b4477b7f29e30e5372cd8204bf
David
2025-04-04T10:13:57
Fix documentation of `BitOps::bit` method (#801) Looks like the correct docs for `bit()` got misplaced.
diff --git a/src/traits.rs b/src/traits.rs index 15babf3..d95adbf 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -696,7 +696,8 @@ pub trait BitOps { /// Precision of this integer in bytes. fn bytes_precision(&self) -> usize; - /// Calculate the number of bits needed to represent this number. + /// ...
1
2
1
356763c717fb60955a2583f569ee26b73018bc21
David
2025-04-03T10:30:38
Expose trait for variable time division (#800) Expose the existing variable time division impls through a trait: `DivVartime` Impl `DivVartime` for `Uint`, `BoxedUint` and `Int`.
diff --git a/src/int/div.rs b/src/int/div.rs index cc2a1bc..11f917d 100644 --- a/src/int/div.rs +++ b/src/int/div.rs @@ -4,7 +4,7 @@ use core::ops::{Div, DivAssign, Rem, RemAssign}; use subtle::CtOption; -use crate::{CheckedDiv, ConstChoice, ConstCtOption, Int, NonZero, Uint, Wrapping}; +use crate::{CheckedDiv, Co...
4
95
6
21ebb49ddb292c4f75ed909e45cdde54888d049e
David
2025-03-18T23:42:22
impl `ConditionallyNegatable` for `BoxedUint` (#795)
diff --git a/src/traits.rs b/src/traits.rs index 814f24f..a68a10d 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -930,7 +930,7 @@ pub trait Monty: /// Allows one to perform inplace multiplication without allocations /// (important for the `BoxedUint` case). /// -/// NOTE: You will be operating with Montgomery rep...
2
25
5
dca28fbb4b986f22c29cc2e3e120470c9823a113
Erik
2025-03-18T18:00:13
Make `random_bits_core` platform independent (#781) In its current state, `random_bits_core` behaves differently on 32-bit and 64-bit targets in two ways: 1. The platforms order the randomly sampled bytes in a different order, generating different outputs. 2. For bit_length $\mod 64 \in [1, 32]$, the 64-bit platform ...
diff --git a/benches/uint.rs b/benches/uint.rs index e45380c..7bbc9e1 100644 --- a/benches/uint.rs +++ b/benches/uint.rs @@ -121,6 +121,27 @@ fn bench_random(c: &mut Criterion) { }); } +fn bench_random_bits(c: &mut Criterion) { + let mut group = c.benchmark_group("random_bits"); + + let mut rng = make_rng...
2
112
5
22cfab7cf7080a376596d55cb6029f567a663c11
Bogdan Opanchuk
2025-03-15T22:24:42
Bound `Monty` on `Retrieve` (#797) Makes it easier to write generic code.
diff --git a/src/traits.rs b/src/traits.rs index 949069f..539a381 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -8,7 +8,7 @@ pub use num_traits::{ pub(crate) use sealed::PrecomputeInverterWithAdjuster; -use crate::{Limb, NonZero, Odd, Reciprocal}; +use crate::{Limb, NonZero, Odd, Reciprocal, modular::Retrieve}...
1
2
1
07005a48fa1383ee82e3905e2c205744522b3667
Arthur Gautier
2025-03-02T22:26:21
Fixup assertion in `AddAssign` and `SubAssign` of `BoxedUint` (#785) Fixes #784
diff --git a/src/uint/boxed/add.rs b/src/uint/boxed/add.rs index 3d2548c..183f7c6 100644 --- a/src/uint/boxed/add.rs +++ b/src/uint/boxed/add.rs @@ -16,7 +16,7 @@ impl BoxedUint { /// Panics if `rhs` has a larger precision than `self`. #[inline] pub fn adc_assign(&mut self, rhs: impl AsRef<[Limb]>, mut c...
2
15
2
8fe22cba8196b08acd06546757f2f474aa20db1e
Bogdan Opanchuk
2025-02-22T22:43:47
Inline low level multiplication and reduction functions (#776) Fixes a performance regression introduced in #667. Evidently, compiler relies a lot on knowing the slice sizes at compile time, so I'm inlining `schoolbook_multiplication()`, `schoolbook_squaring()`, and `montgomery_reduction_inner()`, so the compiler can ...
diff --git a/src/modular/reduction.rs b/src/modular/reduction.rs index 688389f..d6d15b5 100644 --- a/src/modular/reduction.rs +++ b/src/modular/reduction.rs @@ -6,6 +6,7 @@ use crate::{Limb, Odd, Uint}; use {crate::BoxedUint, subtle::Choice}; /// Algorithm 14.32 in Handbook of Applied Cryptography <https://cacr.uwa...
2
3
0
d668d419cf3f5b70ec7d7f1b0094cff78126f2e0
Arthur Gautier
2025-02-22T16:51:37
Provide `RandomMod::try_random_mod` and `Random::try_random` methods (#770)
diff --git a/Cargo.lock b/Cargo.lock index c8443c0..7aa56d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -565,8 +565,7 @@ dependencies = [ [[package]] name = "rand_core" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046...
11
96
47
ad2eab74cb60a7e04af7bb6fdeb8f543d012d3ad
Tony Arcieri
2025-02-21T17:57:30
Bump `hybrid-array` dependency to v0.3 (#773)
diff --git a/Cargo.lock b/Cargo.lock index 3054ca0..c8443c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,9 +317,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hybrid-array" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-l...
2
3
3
1467a11b762475c76690ac9608498ec2691655fe
Tony Arcieri
2025-02-18T22:37:28
v0.7.0-pre.0 (#768)
diff --git a/Cargo.lock b/Cargo.lock index d86b002..3054ca0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-bigint" -version = "0.7.0-pre" +version = "0.7.0-pre.0" dependencies = [ "bincode", "...
2
2
2
534c2940b1f0aa9ec8ada964ce654cc0e6e1e7bb
Arthur Gautier
2025-02-14T19:47:11
chore(deps): bump `der` from `0.7` to `0.8.0-rc.1` (#763) See https://github.com/RustCrypto/crypto-bigint/issues/752
diff --git a/Cargo.lock b/Cargo.lock index 18116b3..d4a90e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,9 +238,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.9" +version = "0.8.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551...
3
5
3
205010bd5cdac17484e91d8f66ff124a41f1f1f3
Tony Arcieri
2025-02-14T19:30:21
Bump version to v0.7.0-pre (#765) Note: not for release, that will be `v0.7.0-pre.0` This sets `master` back to a development branch. v0.6 development now has its own branch: https://github.com/RustCrypto/crypto-bigint/tree/v0.6
diff --git a/Cargo.lock b/Cargo.lock index b9b9036..23a16a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.1" +version = "0.7.0-pre" dependencies = [ "bincode", "criter...
2
2
2
dde72c68a7784dd686fb7dd64603704d009801eb
Bogdan Opanchuk
2025-02-13T21:34:27
Add ?Sized to all RngCore bounds (#760)
diff --git a/src/int/rand.rs b/src/int/rand.rs index 2fa01f6..3902ff7 100644 --- a/src/int/rand.rs +++ b/src/int/rand.rs @@ -8,18 +8,21 @@ use super::Uint; impl<const LIMBS: usize> Random for Int<LIMBS> { /// Generate a cryptographically secure random [`Int`]. - fn random(rng: &mut impl RngCore) -> Self { + ...
9
38
26
cd852ecbecaa49abf878d1cf6432e2c645c78349
Erik
2025-01-31T14:59:38
Make `as_limbs_mut` const (#757)
diff --git a/src/int.rs b/src/int.rs index 3b3d60e..bd304cc 100644 --- a/src/int.rs +++ b/src/int.rs @@ -119,7 +119,7 @@ impl<const LIMBS: usize> Int<LIMBS> { } /// Borrow the limbs of this [`Int`] mutably. - pub fn as_limbs_mut(&mut self) -> &mut [Limb; LIMBS] { + pub const fn as_limbs_mut(&mut self)...
2
2
2
42dddd1dcf3b8ce38ed4be25c00b6246ecb00d3a
Tony Arcieri
2025-01-21T18:05:43
BoxedMontyForm: additional explanatory comments for modpow (#749) Better note why we have to subtract the modulus twice
diff --git a/src/modular/boxed_monty_form/pow.rs b/src/modular/boxed_monty_form/pow.rs index 13638b5..282a0a0 100644 --- a/src/modular/boxed_monty_form/pow.rs +++ b/src/modular/boxed_monty_form/pow.rs @@ -41,9 +41,10 @@ impl PowBoundedExp<BoxedUint> for BoxedMontyForm { } /// Performs modular exponentiation using M...
1
7
3
0761be313b5776c5ce0dec5bef8fab9a1d1b997f
David
2025-01-21T14:15:38
Add a `RemMixed` trait and impl for `Uint`s (#746)
diff --git a/src/traits.rs b/src/traits.rs index f8b4d42..8f77aba 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -626,6 +626,12 @@ pub trait DivRemLimb: Sized { fn div_rem_limb_with_reciprocal(&self, reciprocal: &Reciprocal) -> (Self, Limb); } +/// Support for calculating the remainder of two differently siz...
6
64
5
7fbf36320fc0cee15f6e69ee6efee32ae45126a2
Erik
2025-01-21T14:12:04
`Int` - Gcd (#748) * `impl Gcd for Int` * `impl Gcd<Int> for Uint`
diff --git a/src/int.rs b/src/int.rs index ee9fe1c..3b3d60e 100644 --- a/src/int.rs +++ b/src/int.rs @@ -21,6 +21,7 @@ mod div; mod div_uint; mod encoding; mod from; +mod gcd; mod inv_mod; mod mul; mod mul_uint; diff --git a/src/int/gcd.rs b/src/int/gcd.rs new file mode 100644 index 0000000..0df1245 --- /dev/null...
3
93
2
91f184f2c599cd0016310cd46eea7b364e793531
Tony Arcieri
2025-01-20T19:15:46
v0.6.0-rc.8 (#747)
diff --git a/Cargo.lock b/Cargo.lock index 58f9df7..d07d2f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.0-rc.7" +version = "0.6.0-rc.8" dependencies = [ "bincode", "...
2
2
2
7dc373d2ac101f61dfcb9227a8439fbdc3abb10b
Erik
2025-01-20T17:49:45
`Int` - vartime division operations (#735)
diff --git a/src/int/div.rs b/src/int/div.rs index 3918fbc..5be9dc0 100644 --- a/src/int/div.rs +++ b/src/int/div.rs @@ -76,6 +76,125 @@ impl<const LIMBS: usize> Int<LIMBS> { } } +/// Vartime checked division operations. +impl<const LIMBS: usize> Int<LIMBS> { + #[inline] + /// Variable time equivalent of ...
1
119
0
302a165bbe4efd42e8967545ae4b02e4bb453489
Erik
2025-01-20T17:49:04
`Int` - `Int`-`Uint` interoperability (#736) Adds `Int::div_uint` and `Int::mul_uint`
diff --git a/src/int.rs b/src/int.rs index b8f6157..ee9fe1c 100644 --- a/src/int.rs +++ b/src/int.rs @@ -18,10 +18,12 @@ mod bit_or; mod bit_xor; mod cmp; mod div; +mod div_uint; mod encoding; mod from; mod inv_mod; mod mul; +mod mul_uint; mod neg; mod resize; mod shl; diff --git a/src/int/div_uint.rs b/src/i...
3
797
0
03e1b3a4198209bee9bc255344fa5b3f53e61f59
Erik
2025-01-20T17:45:23
`Int` - `inv_mod` (#737)
diff --git a/src/int.rs b/src/int.rs index 66a8d3e..b8f6157 100644 --- a/src/int.rs +++ b/src/int.rs @@ -20,6 +20,7 @@ mod cmp; mod div; mod encoding; mod from; +mod inv_mod; mod mul; mod neg; mod resize; diff --git a/src/int/inv_mod.rs b/src/int/inv_mod.rs new file mode 100644 index 0000000..8b30791 --- /dev/nul...
2
109
0
dc6bbbbbac664570d4c240ea98acba6d5cd556c4
Tony Arcieri
2025-01-20T02:16:56
Have `rand` feature enable `rand_core/getrandom` (#745) ...as opposed to `rand_core/std`, which links the `std` crate
diff --git a/Cargo.toml b/Cargo.toml index bcbe903..7cf5e07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ default = ["rand"] alloc = ["serdect?/alloc"] extra-sizes = [] -rand = ["rand_core/std"] +rand = ["rand_core/getrandom"] serde = ["dep:serdect"] [package.metadata.docs.rs]
1
1
1
2ebfcd2158e11171e69d79dcaa892b96d051ed56
Tony Arcieri
2025-01-20T01:57:46
v0.6.0-rc.7 (#744)
diff --git a/Cargo.lock b/Cargo.lock index 925a6af..58f9df7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,7 +216,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.0-rc.6" +version = "0.6.0-rc.7" dependencies = [ "bincode", "...
2
2
2
86f7031bcfd2555d1e4d3283a71cf63e30cd1e32
Tony Arcieri
2025-01-20T01:47:16
Downgrade `der` to v0.7 (#743) This unblocks a release by downgrading to the latest stable version so we don't need to wait on a final release of v0.8.
diff --git a/Cargo.lock b/Cargo.lock index e91564c..925a6af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,9 +238,9 @@ dependencies = [ [[package]] name = "der" -version = "0.8.0-rc.1" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82db698b33305f0134faf590b9d1259...
3
3
5
b0e2657af1f69b26db451e4bf0998fce4cd093e4
Tony Arcieri
2025-01-20T01:36:08
Make `Rem` impl on `Uint` constant-time (#742) It was previously using `rem_vartime` as introduced in #466. This goes against the "constant time by default" guarantees of this library.
diff --git a/src/uint/div.rs b/src/uint/div.rs index 9566808..7ca65f5 100644 --- a/src/uint/div.rs +++ b/src/uint/div.rs @@ -861,7 +861,7 @@ impl<const LIMBS: usize> Rem<NonZero<Uint<LIMBS>>> for Uint<LIMBS> { type Output = Uint<LIMBS>; fn rem(self, rhs: NonZero<Uint<LIMBS>>) -> Self::Output { - Self...
1
1
1
1a55153c3a502e174bb81d4398907a74d420a6cf
Tony Arcieri
2025-01-20T01:24:41
Generic `InvMod`: add `Rhs` param and associated `Output` (#741) As needed for #737. This uses a shape similar to the `MulMod` trait.
diff --git a/src/traits.rs b/src/traits.rs index afb763e..f8b4d42 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -458,9 +458,12 @@ pub trait MulMod<Rhs = Self> { } /// Compute `1 / self mod p`. -pub trait InvMod: Sized { +pub trait InvMod<Rhs = Self>: Sized { + /// Output type. + type Output; + /// Co...
3
9
2
65bffd1e568bc469f5fcf7a5013929036c828c9c
Erik
2025-01-20T01:12:23
`Int` - square operations (#734) * Clean up `int::add` * Clean up `int::bit_and` * Clean up `int::bit_or` * Clean up `int::bit_xor` * Clean up `int::neg` * Clean up `int::shr` * Clean up `int::sub` * Clean up `ConstCtOption::as_int` * Clean up `int::mul` * Refactor `Int::div` * Expand `Uint::square` operations * Imple...
diff --git a/src/int/mul.rs b/src/int/mul.rs index 2ed0271..315564c 100644 --- a/src/int/mul.rs +++ b/src/int/mul.rs @@ -4,7 +4,7 @@ use core::ops::{Mul, MulAssign}; use subtle::CtOption; -use crate::{Checked, CheckedMul, ConcatMixed, ConstChoice, Int, Uint, Zero}; +use crate::{Checked, CheckedMul, ConcatMixed, Co...
2
147
7
acb69c40cbde0d1bfcee07bf698883202f656b45
Tony Arcieri
2025-01-18T22:26:10
Modular inversion cleanups (#740) DRYs out some safegcd init by extracting a `const fn`
diff --git a/src/modular/boxed_monty_form/inv.rs b/src/modular/boxed_monty_form/inv.rs index db43305..16536b2 100644 --- a/src/modular/boxed_monty_form/inv.rs +++ b/src/modular/boxed_monty_form/inv.rs @@ -13,8 +13,7 @@ impl BoxedMontyForm { /// Computes `self^-1` representing the multiplicative inverse of `self`, ...
2
18
14
682f17a979c3a1886fde5426b26400dfc3f4775b
Tony Arcieri
2025-01-10T15:02:43
Variable-time modular inversion support (#731) Adds (back) support for computing modular inversions in variable-time with respect to the value being inverted, which computes the specific number of safegcd divsteps to perform based on the input, as opposed to using a worst case number based on the bit length. Clo...
diff --git a/src/modular/boxed_monty_form/inv.rs b/src/modular/boxed_monty_form/inv.rs index 38bf308..db43305 100644 --- a/src/modular/boxed_monty_form/inv.rs +++ b/src/modular/boxed_monty_form/inv.rs @@ -10,19 +10,34 @@ use core::fmt; use subtle::CtOption; impl BoxedMontyForm { - /// Computes `self^-1` represen...
7
186
8
9600cab9949eba52b987e94b6aecbb23ecdc9a79
Erik
2025-01-10T14:52:46
`Int` cleanup (#733)
diff --git a/src/const_choice.rs b/src/const_choice.rs index 2d9f999..5e43e38 100644 --- a/src/const_choice.rs +++ b/src/const_choice.rs @@ -395,7 +395,7 @@ impl<const LIMBS: usize> ConstCtOption<Uint<LIMBS>> { /// Returns the contained value, interpreting the underlying [`Uint`] value as an [`Int`]. #[inline...
10
444
175
f26fcc4d12e0904524043d69985c17269316df3e
David
2025-01-09T20:28:23
Don't provide default impl of bits_vartime (#732)
diff --git a/src/traits.rs b/src/traits.rs index 01f4776..44c6435 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -669,9 +669,7 @@ pub trait BitOps { /// Calculate the number of bits required to represent a given number in variable-time with /// respect to `self`. - fn bits_vartime(&self) -> u32 { - ...
1
1
3
f8c4ac779bd9bf2b7f99e5ee0afb4df13c3df049
Tony Arcieri
2025-01-07T01:23:30
Impl `num_traits::Num` for `Uint` (#720) Also adds the needed `Div` and `Rem` impls to meet the required bounds
diff --git a/src/uint.rs b/src/uint.rs index 44a1853..304d2c6 100644 --- a/src/uint.rs +++ b/src/uint.rs @@ -258,6 +258,15 @@ impl<const LIMBS: usize> Integer for Uint<LIMBS> { } } +impl<const LIMBS: usize> num_traits::Num for Uint<LIMBS> { + type FromStrRadixErr = crate::DecodeError; + + /// ⚠️ WARNING: ...
2
45
0
e2fa911b38eed758aad50d5c6e2eb6f489e457c6
Bogdan Opanchuk
2025-01-06T20:50:39
Add Add/Mul/SubAssign bounds for Integer and implement required traits (#716)
diff --git a/src/traits.rs b/src/traits.rs index 098bd84..01f4776 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -82,6 +82,8 @@ pub trait Integer: 'static + Add<Output = Self> + for<'a> Add<&'a Self, Output = Self> + + AddAssign<Self> + + for<'a> AddAssign<&'a Self> + AddMod<Output = Self> ...
6
92
0
dc7beeaa3a8e38c888f884610773c9e1d8b02a8a
Tony Arcieri
2025-01-06T18:55:49
Bump `serdect` dependency to v0.3 (#719) NOTE: this release includes breaking changes to the wire format. See RustCrypto/formats#1631
diff --git a/Cargo.lock b/Cargo.lock index 607172a..e91564c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -688,9 +688,9 @@ dependencies = [ [[package]] name = "serdect" -version = "0.3.0-rc.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a504c8ee181e3e594d84052f98...
2
3
3
b2b6f7036ba3b629a06c6d46feaea6f79c2c3519
Tony Arcieri
2025-01-04T00:47:13
Cargo.lock: bump dependencies (#718) Updates the following dependencies: $ cargo update Updating crates.io index Locking 61 packages to latest compatible versions Updating anstyle v1.0.7 -> v1.0.10 Updating autocfg v1.3.0 -> v1.4.0 Updating bit-set v0.5.3 -> v0.8.0 Updating bit-vec v0.6.3...
diff --git a/Cargo.lock b/Cargo.lock index d1b5108..607172a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,15 +19,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/...
1
163
127
a0e1b3a25a0a9408734105a2d4be382a7d2976c6
David
2025-01-03T18:27:19
Faster random_mod (#703)
diff --git a/benches/uint.rs b/benches/uint.rs index 96972a0..3bb2a96 100644 --- a/benches/uint.rs +++ b/benches/uint.rs @@ -1,8 +1,125 @@ use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion}; use crypto_bigint::{ - Limb, NonZero, Odd, Random, RandomMod, Reciprocal, Uint, U128, U2048, ...
2
142
16
6993ac05bd038a7876a8628b4bfe1767c955b0cd
David
2025-01-03T18:25:56
Inversion tests (#639) As a follow-up to #606, this PR extends the set of tests for modular inversion.
diff --git a/Cargo.lock b/Cargo.lock index 6c17f44..d1b5108 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" diff --git a/Cargo.toml b/Cargo.toml index 9a0...
4
271
20
c128bbdf5b19768f7538b45bce5f00e08a32ac29
Andrew Whitehead
2024-12-11T19:36:26
Fix modulus leading zeros calculation for (Boxed)`MontyForm` (#713) Fixes #707 Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index b7c90e6..78d5774 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -97,7 +97,7 @@ impl BoxedMontyParams { let mod_neg_inv = Limb(Word::MIN.wrapping_sub(inv_mod_limb.limbs[0].0)); - ...
4
34
6
b331028ec9be6fb5245ca132e00997fe932f3975
Bogdan Opanchuk
2024-12-08T01:17:58
Add RemAssign bound to Integer (#709)
diff --git a/src/traits.rs b/src/traits.rs index 0c081b5..098bd84 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -12,7 +12,7 @@ use crate::{Limb, NonZero, Odd, Reciprocal}; use core::fmt::{self, Debug}; use core::ops::{ Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAs...
1
3
1
c3ac6f14c3fa64713bdc69e7786963c1d5e634c5
Aaron Feickert
2024-12-08T01:17:41
Update documentation for random functionality (#711)
diff --git a/src/non_zero.rs b/src/non_zero.rs index 7465ec6..2bcdea6 100644 --- a/src/non_zero.rs +++ b/src/non_zero.rs @@ -232,10 +232,12 @@ impl<T> Random for NonZero<T> where T: Random + Zero, { + /// This uses rejection sampling to avoid zero. + /// + /// As a result, it runs in variable time. If t...
4
11
30
1310938f64498a6a3fab08354552bdaa665e7b62
Aaron Feickert
2024-12-08T01:17:28
Add boxed Montgomery zeroizing support (#708)
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index 0049c18..b7c90e6 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -307,6 +307,14 @@ impl Monty for BoxedMontyForm { } } +/// NOTE: This zeroizes the value, but _not_ the associated parameter...
1
8
0
e87d7f47f5646b0e066c653bf5efe6a6749fc6c4
Bogdan Opanchuk
2024-12-07T23:07:08
Require `RngCore` instead of `CryptoRngCore` for various random methods (#710)
diff --git a/src/lib.rs b/src/lib.rs index cdfab0a..a2aa913 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,7 +117,7 @@ //! ### Random number generation //! //! When the `rand_core` or `rand` features of this crate are enabled, it's -//! possible to generate random numbers using any CSRNG by using the +//! possible...
9
57
63
5cab3fa67040f63f82d36a8e4112a3488d3b02aa
Aaron Feickert
2024-12-02T19:58:17
Add zeroizing support for `MontyParams` (#706)
diff --git a/src/modular/monty_form.rs b/src/modular/monty_form.rs index 945a8c2..54f0d1a 100644 --- a/src/modular/monty_form.rs +++ b/src/modular/monty_form.rs @@ -158,6 +158,18 @@ impl<const LIMBS: usize> ConstantTimeEq for MontyParams<LIMBS> { } } +#[cfg(feature = "zeroize")] +impl<const LIMBS: usize> zeroiz...
1
14
2
986faf2e2e4e73888206c024572b9ce782a3c052
Erik
2024-11-12T20:29:19
Add `Int` bit ops (#697)
diff --git a/src/const_choice.rs b/src/const_choice.rs index 8b5d434..2d9f999 100644 --- a/src/const_choice.rs +++ b/src/const_choice.rs @@ -1,6 +1,6 @@ use subtle::{Choice, CtOption}; -use crate::{modular::SafeGcdInverter, Limb, NonZero, Odd, Uint, WideWord, Word}; +use crate::{modular::SafeGcdInverter, Int, Limb, ...
11
901
4
7695c1db7ca80ebfbb3233ac05a9576ec35bca9d
Tony Arcieri
2024-10-08T01:40:53
Remove `const_assert_*` (#690) These were half-baked and cause weird compile errors in several situations. We'll be better off with const support for `assert_eq`/`assert_ne` whenever that lands.
diff --git a/src/macros.rs b/src/macros.rs index 3de5fbe..803ecb7 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -24,59 +24,6 @@ macro_rules! safegcd_nlimbs { }; } -/// Internal implementation detail of [`const_assert_eq`] and [`const_assert_ne`]. -#[doc(hidden)] -#[macro_export] -macro_rules! const_assert_n...
2
1
54
be1202e007f59882a2c00feb5c9b2b68e9fc088f
Tony Arcieri
2024-10-08T01:13:08
Even more `div_ceil` fixes (#691) Fixes the remaining cases which were missed in #688 and #689
diff --git a/src/uint/boxed.rs b/src/uint/boxed.rs index 348708f..c1d10c6 100644 --- a/src/uint/boxed.rs +++ b/src/uint/boxed.rs @@ -55,7 +55,7 @@ pub struct BoxedUint { impl BoxedUint { fn limbs_for_precision(at_least_bits_precision: u32) -> usize { - ((at_least_bits_precision + Limb::BITS - 1) / Limb::...
2
2
2
c29641918ca9ddaf505d0b1752dc5c056b035cc2
Tony Arcieri
2024-10-08T00:57:38
Further leverage `div_ceil` (#689) Followup to #688 which uses `div_ceil` in feature-gated code, which was missed before
diff --git a/src/uint/boxed/div.rs b/src/uint/boxed/div.rs index 6663991..0dd18c4 100644 --- a/src/uint/boxed/div.rs +++ b/src/uint/boxed/div.rs @@ -50,7 +50,7 @@ impl BoxedUint { /// /// Variable-time with respect to `rhs` pub fn div_rem_vartime(&self, rhs: &NonZero<Self>) -> (Self, Self) { - let...
2
3
3
8f3f9f2d3e99bd033ade1868b88d832e5ee9c367
Tony Arcieri
2024-10-08T00:43:00
Leverage `div_ceil` (#688) Fixes clippy warnings about `div_ceil` which are appearing on recent nightlies
diff --git a/src/macros.rs b/src/macros.rs index 66d62de..3de5fbe 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -5,7 +5,7 @@ #[macro_export] macro_rules! nlimbs { ($bits:expr) => { - (($bits + $crate::Limb::BITS - 1) / $crate::Limb::BITS) as usize + u32::div_ceil($bits, $crate::Limb::BITS) as u...
3
6
6
d5f8569124d2ff397a8754b9bdcbe06e91c4dade
Tony Arcieri
2024-10-05T15:14:20
v0.6.0-rc.6 (#687)
diff --git a/Cargo.lock b/Cargo.lock index 604c545..f043d68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,7 +210,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.0-rc.5" +version = "0.6.0-rc.6" dependencies = [ "bincode", "...
2
2
2
0c3270319c190df640edc31511cc351e62fa7846
Andrew Whitehead
2024-10-05T01:01:35
add double and lincomb_vartime methods to Monty trait (#686) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index 6e845b6..0049c18 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -294,9 +294,17 @@ impl Monty for BoxedMontyForm { &self.montgomery_form } + fn double(&self) -> Self { + B...
5
32
4
0b521ffe1a8678803e1688400f99f7253a26f4dc
David
2024-10-04T13:40:23
Fix `rem_wide_vartime` (#685) Fix thanks to @andrewwhitehead + distilled test case
diff --git a/src/uint/div.rs b/src/uint/div.rs index 782c7bc..8a3f5df 100644 --- a/src/uint/div.rs +++ b/src/uint/div.rs @@ -405,6 +405,7 @@ impl<const LIMBS: usize> Uint<LIMBS> { if xi == yc - 1 { break; } + x[xi] = Limb::ZERO; xi -...
1
17
0
b1e00a5ace899cf30b2c2b28f8835906c509204d
Aaron Feickert
2024-09-28T12:21:44
Fix documentation (#683)
diff --git a/src/uint/cmp.rs b/src/uint/cmp.rs index 482c387..eeb9a55 100644 --- a/src/uint/cmp.rs +++ b/src/uint/cmp.rs @@ -54,7 +54,7 @@ impl<const LIMBS: usize> Uint<LIMBS> { Limb(acc).is_nonzero().not() } - /// Returns the truthy value if `self <= rhs` and the falsy value otherwise. + /// Retu...
1
2
2
1c946074e6a7f589cf89e3c91448d0068d730a88
Tony Arcieri
2024-09-19T20:35:02
Remove `std` feature; leverage `core::error::Error` (#680) Now that the MSRV is 1.81, use `core::error::Error` instead of `std::error::Error`. Since this was our only dependency on `std`, we can also remove the entire `std` feature.
diff --git a/Cargo.toml b/Cargo.toml index dfa1686..21954b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,6 @@ rand_chacha = "0.3" [features] default = ["rand"] alloc = ["serdect?/alloc"] -std = ["alloc"] extra-sizes = [] rand = ["rand_core/std"] diff --git a/src/lib.rs b/src/lib.rs index 7afa680..cdfab0...
4
3
9
2a1805f6ad86cddd3f6f2a1dda2f7cbe5c83af35
Tony Arcieri
2024-09-19T17:15:00
v0.6.0-rc.5 (#678)
diff --git a/Cargo.lock b/Cargo.lock index ac0b415..0b3e9c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,7 +210,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.0-rc.4" +version = "0.6.0-rc.5" dependencies = [ "bincode", "...
2
2
2
b3ee23ca3ef9ac86eda00064225c2d4b6a96cee3
Tony Arcieri
2024-09-19T17:07:09
Add `BoxedMontyParams::from_const_params` (#677) Support for constructing boxed params from `ConstMontyParams`. Closes #593
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index e622b5f..020ccb3 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -11,7 +11,7 @@ mod sub; use super::{ div_by_2, reduction::{montgomery_reduction_boxed, montgomery_reduction_boxed_mut}, -...
1
13
1
21cba9515e6af1ee56ccdcf0d05bbe2434d3a313
Andrew Whitehead
2024-09-19T16:51:46
Add efficient linear combination for Montgomery forms (#666) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/benches/boxed_monty.rs b/benches/boxed_monty.rs index a4fd197..f10663c 100644 --- a/benches/boxed_monty.rs +++ b/benches/boxed_monty.rs @@ -156,6 +156,27 @@ fn bench_montgomery_ops<M: Measurement>(group: &mut BenchmarkGroup<'_, M>) { BatchSize::SmallInput, ) }); + + group.benc...
13
456
2
20059a76ecdca34aeb8137dc289373003da65ae9
Andrew Whitehead
2024-09-19T16:47:35
Montgomery form arithmetic improvements (#664) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/benches/boxed_monty.rs b/benches/boxed_monty.rs index b621a1f..a4fd197 100644 --- a/benches/boxed_monty.rs +++ b/benches/boxed_monty.rs @@ -19,7 +19,69 @@ fn to_biguint(uint: &BoxedUint) -> BigUint { fn bench_montgomery_ops<M: Measurement>(group: &mut BenchmarkGroup<'_, M>) { let params = BoxedMontyP...
17
429
44
6cb2d09c003c7e5e08c82a674c70c351e030a513
Andrew Whitehead
2024-09-19T16:35:33
Add radix string encoding for Uint, BoxedUint (#659) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/benches/boxed_uint.rs b/benches/boxed_uint.rs index 03047b5..46fc673 100644 --- a/benches/boxed_uint.rs +++ b/benches/boxed_uint.rs @@ -1,5 +1,6 @@ use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion}; use crypto_bigint::{BoxedUint, Limb, NonZero, RandomBits}; +use num_bigint...
6
490
22
cb09aa112b1ae3aa38fcc8fffc1e678f9ddb0506
Tony Arcieri
2024-09-19T16:32:22
Add doc comment support to `impl_modulus!` (#676) Closes #662
diff --git a/src/modular/const_monty_form/macros.rs b/src/modular/const_monty_form/macros.rs index 93c331b..3d7f03d 100644 --- a/src/modular/const_monty_form/macros.rs +++ b/src/modular/const_monty_form/macros.rs @@ -13,6 +13,15 @@ #[macro_export] macro_rules! impl_modulus { ($name:ident, $uint_type:ty, $value:e...
1
9
0
ba70b3be4f4918d5b79b85376ebff247fed529b8
Tony Arcieri
2024-09-10T20:42:54
crypto-bigint v0.6.0-rc.4 (#672)
diff --git a/Cargo.lock b/Cargo.lock index 97bac29..e26b8ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,7 +210,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.0-rc.3" +version = "0.6.0-rc.4" dependencies = [ "bincode", "...
2
2
2
a0b45d8d56f62b71694485e883f40bda393be00d
Tony Arcieri
2024-09-10T20:15:33
Bump `der` dependency to v0.8.0-rc.1 (#671) Uses the latest prerelease
diff --git a/Cargo.lock b/Cargo.lock index 12f2ddc..97bac29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.9" +version = "0.8.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551...
3
6
4
9cc3e4a1c1d511241163c1ce0865b38a60989269
Tony Arcieri
2024-09-10T19:20:10
Bump `serdect` to v0.3.0-rc.0 (#670)
diff --git a/Cargo.lock b/Cargo.lock index 48f6979..12f2ddc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -684,9 +684,9 @@ dependencies = [ [[package]] name = "serdect" -version = "0.2.0" +version = "0.3.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d...
3
3
35
db9d587899c27d291e0a2d1fafe5bbc97c38b4ac
Andrew Whitehead
2024-09-06T17:28:58
Use `rem_wide_vartime` in `Uint::mul_mod_vartime` (#669) Also adds benchmarks for Uint modular multiplication. Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/benches/uint.rs b/benches/uint.rs index ff63752..96972a0 100644 --- a/benches/uint.rs +++ b/benches/uint.rs @@ -1,5 +1,7 @@ use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion}; -use crypto_bigint::{Limb, NonZero, Odd, Random, Reciprocal, Uint, U128, U2048, U256, U4096}; +use ...
2
41
11
3e154313f87ff3e8a2e335306cd2b54e75170e62
Tony Arcieri
2024-09-06T02:30:18
Fix `clippy::too_long_first_doc_paragraph` violations (#668) This is a `nightly`-only lint but it caught some rustdoc comments which are too long and needed to be broken up with more newlines.
diff --git a/src/modular/const_monty_form.rs b/src/modular/const_monty_form.rs index ae4d2a7..085554d 100644 --- a/src/modular/const_monty_form.rs +++ b/src/modular/const_monty_form.rs @@ -27,8 +27,9 @@ use { #[macro_use] mod macros; -/// The parameters to efficiently go to and from the Montgomery form for a given ...
2
7
5
0c72b4b8945906617cc77b09784df9355b6c8f57
Aaron Feickert
2024-09-04T20:22:44
Fix documentation (#665)
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index 5d98915..a3853ce 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -1,4 +1,4 @@ -//! is chosen at runtime. +//! Implements heap-allocated `BoxedMontyForm`s, supporting modular arithmetic with a modul...
1
1
1
16c3442bb0f1c01d6fad6954a8f4c20921a4d584
Tony Arcieri
2024-08-21T18:58:54
v0.6.0-rc.3 (#660)
diff --git a/Cargo.lock b/Cargo.lock index 3117135..48f6979 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,7 +210,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.6.0-rc.2" +version = "0.6.0-rc.3" dependencies = [ "bincode", "...
2
2
2
52fee04617d938ba7b8b2e7da74c03fbc0762cdc
Bogdan Opanchuk
2024-08-21T18:53:12
Some simplifications of vartime division (#661) Second attempt at #646
diff --git a/src/uint/boxed/div.rs b/src/uint/boxed/div.rs index 9d061fc..6663991 100644 --- a/src/uint/boxed/div.rs +++ b/src/uint/boxed/div.rs @@ -1,9 +1,12 @@ //! [`BoxedUint`] division operations. use crate::{ - uint::{boxed, div_limb::div3by2}, + uint::{ + boxed, + div_limb::{div2by1, div3b...
3
250
201
325e16ba9c6bb6c1d81d0c9a382a380f24f2598c
Tony Arcieri
2024-08-20T14:05:51
Revert "Some simplifications of vartime division (#646)" (#658) This reverts commit e7d3b16dd4fc377b4de963f16ab845a2cce185ee. This needs changes as upstream diverged.
diff --git a/src/uint/boxed/div.rs b/src/uint/boxed/div.rs index 4558fff..9d061fc 100644 --- a/src/uint/boxed/div.rs +++ b/src/uint/boxed/div.rs @@ -382,42 +382,6 @@ impl RemLimb for BoxedUint { } } -/// Computes `limbs << shift` inplace, where `0 <= shift < Limb::BITS`, returning the carry. -fn shl_limb_vartim...
3
190
224
e7d3b16dd4fc377b4de963f16ab845a2cce185ee
Bogdan Opanchuk
2024-08-20T13:48:00
Some simplifications of vartime division (#646)
diff --git a/src/uint/boxed/div.rs b/src/uint/boxed/div.rs index 9d061fc..4558fff 100644 --- a/src/uint/boxed/div.rs +++ b/src/uint/boxed/div.rs @@ -382,6 +382,42 @@ impl RemLimb for BoxedUint { } } +/// Computes `limbs << shift` inplace, where `0 <= shift < Limb::BITS`, returning the carry. +fn shl_limb_vartim...
3
224
190
8520fdbfd08fb06a3ce15b5ade816d4bc510a9eb
Andrew Whitehead
2024-08-18T18:20:53
Faster constant-time division (#643) This replaces the `div_rem` method for Uint and BoxedUint with one based on the updated vartime division method. Unlike the old method, this one panics if `NonZero(0)` is given as the divisor. The `sqrt` method relied on the old behavior and is updated. The `Default` implem...
diff --git a/benches/uint.rs b/benches/uint.rs index a5b9341..ff63752 100644 --- a/benches/uint.rs +++ b/benches/uint.rs @@ -320,6 +320,14 @@ fn bench_sqrt(c: &mut Criterion) { BatchSize::SmallInput, ) }); + + group.bench_function("sqrt_vartime, U256", |b| { + b.iter_batched( + ...
9
227
137
de72555d238eababeb6451a6d085dcb4a7625814
Andrew Whitehead
2024-08-16T23:03:16
Implement Karatsuba multiplication for Uint and BoxedUint (#649) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/src/const_choice.rs b/src/const_choice.rs index 1428ba2..524a352 100644 --- a/src/const_choice.rs +++ b/src/const_choice.rs @@ -182,6 +182,11 @@ impl ConstChoice { Self(self.0 & other.0) } + #[inline] + pub(crate) const fn xor(&self, other: Self) -> Self { + Self(self.0 ^ other...
5
590
38
2952c76afb424d8c974c91aca76dc4d02dd20f18
Tony Arcieri
2024-08-16T18:44:19
safegcd: remove branch in iterations calculation (#656)
diff --git a/src/modular/safegcd.rs b/src/modular/safegcd.rs index 8c9114f..b2f5ccd 100644 --- a/src/modular/safegcd.rs +++ b/src/modular/safegcd.rs @@ -341,13 +341,9 @@ const fn de<const LIMBS: usize>( // TODO(tarcieri): improved bounds using https://github.com/sipa/safegcd-bounds pub(crate) const fn iterations(f_bi...
1
11
7
ae3009386e837a524a8afb14a0780ac89ecd3ff2
Tony Arcieri
2024-08-16T18:21:25
safegcd: add TODO to implement safegcd-bounds See also: #634
diff --git a/src/modular/safegcd.rs b/src/modular/safegcd.rs index c280bdd..8c9114f 100644 --- a/src/modular/safegcd.rs +++ b/src/modular/safegcd.rs @@ -8,6 +8,7 @@ //! Copyright (c) 2023 Privacy Scaling Explorations Team // TODO(tarcieri): optimized implementation for 32-bit platforms (#380) +// TODO(tarcieri): op...
1
1
0
ce240f1d597f9f30d73c60d17441b1b67e7046fa
Tony Arcieri
2024-08-16T17:54:22
BoxedUint: `Sub` impls for stack allocated types (#654) Adds `Sub` impls for `BoxedUint` for the following `rhs` types, similar to what #650 did for `Add`: - `Uint<LIMBS>` - `u8` - `u16` - `u32` - `u64` - `u128` The primitive integer types convert to `Uint<LIMBS>` then leverate the `Sub` impl for that.
diff --git a/src/uint/boxed/sub.rs b/src/uint/boxed/sub.rs index 64537a4..3462273 100644 --- a/src/uint/boxed/sub.rs +++ b/src/uint/boxed/sub.rs @@ -1,6 +1,6 @@ //! [`BoxedUint`] subtraction operations. -use crate::{BoxedUint, CheckedSub, Limb, Wrapping, WrappingSub, Zero}; +use crate::{BoxedUint, CheckedSub, Limb, ...
1
113
4
edf1f46896036925a0b2e1ca57403d13b0f65f52
Tony Arcieri
2024-08-16T13:39:49
Bernstein-Yang: boxing optimizations (#653) Adds a `BoxedUnsatInt::from_uint_widened` constructor which can be used to pad all `BoxedUnsatInt`s used as parameters to Bernstein-Yang to the same size at allocation time, rather than retroactively widening them to be the same size which may incur an additional allocati...
diff --git a/src/modular/bernstein_yang/boxed.rs b/src/modular/bernstein_yang/boxed.rs index 0bf5194..140deb0 100644 --- a/src/modular/bernstein_yang/boxed.rs +++ b/src/modular/bernstein_yang/boxed.rs @@ -69,14 +69,26 @@ impl Inverter for BoxedBernsteinYangInverter { } } +/// Compute the number of unsaturated l...
2
45
24
6df8d895ece2a399e1a440a1b4a88d864ddea632
Tony Arcieri
2024-08-16T13:07:54
Fix typo: Mongtgomery -> Montgomery
diff --git a/src/modular/div_by_2.rs b/src/modular/div_by_2.rs index bdb1e9a..c426c62 100644 --- a/src/modular/div_by_2.rs +++ b/src/modular/div_by_2.rs @@ -17,7 +17,7 @@ pub(crate) const fn div_by_2<const LIMBS: usize>( // Note that this also works if `a` is a Montgomery representation modulo `modulus` // of...
1
1
1
d114863449d183a80e7a19884675900043d2a547
Tony Arcieri
2024-08-16T03:18:42
BoxedUint: `Add` impls for stack allocated types (#650) Adds `Add` impls for `BoxedUint` for the following `rhs` types: - `Uint<LIMBS>` - `u8` - `u16` - `u32` - `u64` - `u128` The primitive integer types convert to `Uint<LIMBS>` then leverate the `Add` impl for that.
diff --git a/src/uint/boxed/add.rs b/src/uint/boxed/add.rs index b264cda..991c8f5 100644 --- a/src/uint/boxed/add.rs +++ b/src/uint/boxed/add.rs @@ -1,6 +1,6 @@ //! [`BoxedUint`] addition operations. -use crate::{BoxedUint, CheckedAdd, Limb, Wrapping, WrappingAdd, Zero}; +use crate::{BoxedUint, CheckedAdd, Limb, Uin...
1
113
4
8534397e822c8e63a9e4640b04b2035c9a6c459e
Tony Arcieri
2024-08-16T02:52:40
Bernstein-Yang: support boxed GCD with different size inputs (#652) Implicitly widens inputs to the size of the largest before computing Bernstein-Yang for GCD.
diff --git a/src/modular/bernstein_yang/boxed.rs b/src/modular/bernstein_yang/boxed.rs index 2b253cc..0bf5194 100644 --- a/src/modular/bernstein_yang/boxed.rs +++ b/src/modular/bernstein_yang/boxed.rs @@ -5,8 +5,11 @@ use super::{inv_mod2_62, iterations, jump, Matrix}; use crate::{BoxedUint, Inverter, Limb, Odd, Wo...
2
22
25
5c3feb9f8d14dd24f23184a10e7a87b946aa3933
Tony Arcieri
2024-08-16T02:24:25
Bernstein-Yang: fix `BoxedUnsatInt::one` (#651)
diff --git a/src/modular/bernstein_yang/boxed.rs b/src/modular/bernstein_yang/boxed.rs index af7f0e0..2b253cc 100644 --- a/src/modular/bernstein_yang/boxed.rs +++ b/src/modular/bernstein_yang/boxed.rs @@ -371,10 +371,10 @@ impl BoxedUnsatInt { Self(vec![0; nlimbs].into()) } - /// Get the value zero f...
1
2
2
62babd92e4705cee3218d364371a95dc58e504b9
Bogdan Opanchuk
2024-08-15T23:39:32
Add a test for BoxedUint::gcd(_vartime) where the rhs has a different number of limbs (#642)
diff --git a/src/modular/bernstein_yang/boxed.rs b/src/modular/bernstein_yang/boxed.rs index 359d267..af7f0e0 100644 --- a/src/modular/bernstein_yang/boxed.rs +++ b/src/modular/bernstein_yang/boxed.rs @@ -68,6 +68,11 @@ impl Inverter for BoxedBernsteinYangInverter { /// Returns the greatest common divisor (GCD) of t...
2
28
0
f5094eb911d53fe5cc007b26adac8cd764f3ec73
Andrew Whitehead
2024-08-15T23:37:37
handle remainder as a wide word in div3by2 (#647) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/src/const_choice.rs b/src/const_choice.rs index d45f6f2..e3203fd 100644 --- a/src/const_choice.rs +++ b/src/const_choice.rs @@ -1,6 +1,6 @@ use subtle::{Choice, CtOption}; -use crate::{modular::BernsteinYangInverter, Limb, NonZero, Odd, Uint, Word}; +use crate::{modular::BernsteinYangInverter, Limb, Non...
2
51
15
4c84cbcf269c3850990414baa21e50288258c8d0
Andrew Whitehead
2024-08-15T23:36:53
clean up proptest clippy warnings, asserts (#644) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/tests/bernstein_yang.rs b/tests/bernstein_yang.rs index 1c05341..d73e84e 100644 --- a/tests/bernstein_yang.rs +++ b/tests/bernstein_yang.rs @@ -31,7 +31,7 @@ prop_compose! { bytes = &bytes[..32]; } - BoxedUint::from_le_slice(&bytes, 256).unwrap() + BoxedUint::from_le_s...
6
97
94
a0b43e01831223ba1173ce8c50273bb4a4a20f1e
Andrew Whitehead
2024-08-13T18:01:22
Move schoolbook squaring implementation into a macro (#648) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/benches/boxed_uint.rs b/benches/boxed_uint.rs index 99b73e6..03047b5 100644 --- a/benches/boxed_uint.rs +++ b/benches/boxed_uint.rs @@ -43,6 +43,31 @@ fn bench_shifts(c: &mut Criterion) { group.finish(); } +fn bench_mul(c: &mut Criterion) { + let mut group = c.benchmark_group("wrapping ops"); + ...
4
170
69
759684dc8b3d11d8c622d2b77b6c79e2bb894481
Tony Arcieri
2024-08-08T17:23:58
BoxedMontyForm: always use `Arc` for `params` (#645) `Arc` was previously gated on `std` but is available as `alloc::sync::Arc`. Since `BoxedMontyForm` depends on `alloc` anyway, we can unconditionally use `Arc` for the params. Using `Arc` avoids having to clone/duplicate the params every time a new `BoxedMon...
diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs index 5098d5d..5d98915 100644 --- a/src/modular/boxed_monty_form.rs +++ b/src/modular/boxed_monty_form.rs @@ -13,9 +13,7 @@ use super::{ Retrieve, }; use crate::{BoxedUint, Limb, Monty, Odd, Word}; - -#[cfg(feature = "std")] -use std:...
2
2
18
c18700e22b8d995ea46f0be7073bf2124483ed48
Andrew Whitehead
2024-08-06T20:00:28
Fix vartime division edge case (#641) Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
diff --git a/src/uint/boxed/div.rs b/src/uint/boxed/div.rs index acb61a7..6ac29f7 100644 --- a/src/uint/boxed/div.rs +++ b/src/uint/boxed/div.rs @@ -1,9 +1,9 @@ //! [`BoxedUint`] division operations. use crate::{ - uint::{boxed, div_limb::div2by1}, + uint::{boxed, div_limb::div3by2}, BoxedUint, CheckedDi...
4
106
52
7513449fb60fd305f9dda5d746d1f9fbef6784da
Tony Arcieri
2024-08-05T21:04:44
Fix remaining `int62l` references (#640) The type has been renamed to `UnsatInt`, and the functions to `unsatint`
diff --git a/src/modular/bernstein_yang.rs b/src/modular/bernstein_yang.rs index 6f07989..922a156 100644 --- a/src/modular/bernstein_yang.rs +++ b/src/modular/bernstein_yang.rs @@ -587,14 +587,14 @@ mod tests { } #[test] - fn int62l_add() { + fn unsatint_add() { assert_eq!(UnsatInt::ZERO, Uns...
2
14
14
6b58de4b23fd15dd44bba810881c72b6b0ab3a6f
Tony Arcieri
2024-08-05T01:20:15
Rename `*Int62L` => `*UnsatInt` (#637) These types are used within the Bernstein-Yang implementation(s) and implements a 62-bit unsaturated form used by the algorithm.
diff --git a/src/modular/bernstein_yang.rs b/src/modular/bernstein_yang.rs index 162d1f2..6f07989 100644 --- a/src/modular/bernstein_yang.rs +++ b/src/modular/bernstein_yang.rs @@ -46,10 +46,10 @@ use subtle::CtOption; #[derive(Clone, Debug)] pub struct BernsteinYangInverter<const SAT_LIMBS: usize, const UNSAT_LIMBS:...
2
141
135