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 |
|---|---|---|---|---|---|---|---|
7e3ab549e785b058e69996b776c58c3715d6250a | Tony Arcieri | 2026-02-02T01:36:09 | Replace `nlimbs!` macro with `const fn nlimbs()` (#1169)
The `const fn` can do everything the macro can do.
This additionally makes the implementation constant-time and better
tests the boundary conditions. | diff --git a/src/lib.rs b/src/lib.rs
index 793c339..53cd961 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -160,7 +160,7 @@ pub use crate::{
checked::Checked,
int::{types::*, *},
jacobi::JacobiSymbol,
- limb::Limb,
+ limb::{Limb, nlimbs},
non_zero::*,
odd::*,
traits::*,
@@ -191,9 +191,6... | 5 | 47 | 42 |
69a02e7fdd2d8ab79ce537dcad800e1b00da5420 | Andrew Whitehead | 2026-02-02T01:26:00 | Add test coverage for `Checked`, `Wrapping`, `JacobiSymbol` (#1168)
Serde support is not tested, that could use some work across the crate
but probably needs another dev dependency.
---------
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/checked.rs b/src/checked.rs
index aefa3ee..5f64a1c 100644
--- a/src/checked.rs
+++ b/src/checked.rs
@@ -18,6 +18,15 @@ impl<T> Checked<T> {
pub const fn new(val: T) -> Self {
Self(CtOption::some(val))
}
+
+ /// Create a new checked arithmetic wrapper for the given value.
+ #[cf... | 4 | 468 | 5 |
e59c7c931bec4aa35d38a9845dcf249504c8c870 | Tony Arcieri | 2026-02-01T18:10:51 | v0.7.0-rc.23 (#1167)
Includes `rand_core` bump to v0.10.0 | diff --git a/Cargo.lock b/Cargo.lock
index 932dc9d..643faad 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -230,7 +230,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.22"
+version = "0.7.0-rc.23"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
7d6e110ec26457be4c7d253bdbcdbc86472182eb | Tony Arcieri | 2026-02-01T17:53:34 | Enable `clippy::integer_division_remainder_used` lint (#1166)
Division and remainder are non-constant-time operations which have been
implicated in real-world security vulnerabilities:
https://kyberslash.cr.yp.to/
This enables a lint that looks for occurences of it, and marks places
where it's currently occurring wi... | diff --git a/Cargo.toml b/Cargo.toml
index 916c470..60380e1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -64,6 +64,7 @@ checked_conversions = "warn"
doc_markdown = "warn"
from_iter_instead_of_collect = "warn"
implicit_saturating_sub = "warn"
+integer_division_remainder_used = "warn" # not constant time (see Kyberslas... | 32 | 78 | 24 |
e8b3a705fdde49ae6464a344714e3e996935b64d | Andrew Whitehead | 2026-02-01T17:18:28 | Implement division and remainder operations for Limb (#1162)
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/limb.rs b/src/limb.rs
index af79228..9a57fdc 100644
--- a/src/limb.rs
+++ b/src/limb.rs
@@ -9,6 +9,7 @@ mod bit_xor;
mod bits;
mod cmp;
mod ct;
+mod div;
mod encoding;
mod from;
mod mul;
diff --git a/src/limb/div.rs b/src/limb/div.rs
new file mode 100644
index 0000000..6ea80e7
--- /dev/null
+++ b... | 2 | 298 | 0 |
77bdacd758281c46871761f29c1081d6445d3d32 | Andrew Whitehead | 2026-02-01T16:26:52 | Add standard tests for types implementing `Unsigned` or `Signed` (#1161)
Adding some sanity tests on integer behavior and providing code coverage
for many trait implementations.
---------
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/int.rs b/src/int.rs
index d2efebf..32a2839 100644
--- a/src/int.rs
+++ b/src/int.rs
@@ -496,4 +496,9 @@ mod tests {
assert_eq!(I128::ONE.try_into_uint().unwrap(), U128::ONE);
assert_eq!(I128::MAX.try_into_uint().unwrap(), U128::MAX >> 1);
}
+
+ #[test]
+ fn test_signed() {
... | 4 | 555 | 0 |
8a495fa6dd391dcad066e08872292726dc4920ef | Andrew Whitehead | 2026-02-01T16:23:40 | Add exponentiation methods for `BoxedUint` (#1159)
This implements `wrapping_pow`, `wrapping_pow_bounded_exp`,
`wrapped_pow_vartime` for `BoxedUint`, as well as checked and saturating
versions of these methods.
Multiplication support (references to the `karatsuba` module and
overflow checks) are moved into `UintRef`.... | diff --git a/benches/boxed_uint.rs b/benches/boxed_uint.rs
index 08f1231..bbc746f 100644
--- a/benches/boxed_uint.rs
+++ b/benches/boxed_uint.rs
@@ -108,6 +108,32 @@ fn bench_mul(c: &mut Criterion) {
BatchSize::SmallInput,
);
});
+
+ group.bench_function("boxed_wrapping_pow", |b| {
+ ... | 11 | 632 | 80 |
23497e1b3ca8affe1c585565496caf93f71a04c6 | Tony Arcieri | 2026-02-01T16:15:00 | Bump `rand_core` to v0.10 (#1165)
Release notes:
https://github.com/rust-random/rand_core/releases/tag/v0.10.0 | diff --git a/Cargo.lock b/Cargo.lock
index 9064c85..932dc9d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -88,13 +88,13 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "chacha20"
-version = "0.10.0-rc.9"
+version = "0.10.0-rc.10"
source = "registry+https://github.c... | 2 | 10 | 10 |
f25910b22d944760c5049c4d3ab7aee3fad080e9 | Andrew Whitehead | 2026-01-29T17:14:55 | Speed up slow tests when testing with miri (#1163)
These changes reduce the rounds and input sizes for some particularly
slow tests, found with `cargo +nightly miri test --lib --
-Zunstable-options --report-time`
Looks like the execution time is down to 4-5 minutes instead of 8-9
minutes on GHA.
Signed-off-by: Andre... | diff --git a/src/uint/boxed/encoding.rs b/src/uint/boxed/encoding.rs
index 1f4a496..106ceaa 100644
--- a/src/uint/boxed/encoding.rs
+++ b/src/uint/boxed/encoding.rs
@@ -639,8 +639,10 @@ mod tests {
use rand_core::SeedableRng;
let mut rng = chacha20::ChaCha8Rng::seed_from_u64(1);
- for _ in 0.... | 8 | 24 | 15 |
dda6237d9c6f4ce022fe7132e257622e3514803f | Tony Arcieri | 2026-01-24T18:45:50 | Cargo.lock: bump dependencies (#1158)
This is mostly to clear the security audit.
Updates the following dependencies:
$ cargo update
Updating crates.io index
Locking 4 packages to latest compatible versions
Updating cmov v0.5.1 -> v0.5.2
Updating proc-macro2 v1.0.105 -> v1.0.106
Updating quo... | diff --git a/Cargo.lock b/Cargo.lock
index 22e52d8..9064c85 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -151,9 +151,9 @@ checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
[[package]]
name = "cmov"
-version = "0.5.1"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crat... | 1 | 8 | 8 |
8a5d2de4ee00244b89166512ddf2a9b0cb740bfa | Tony Arcieri | 2026-01-24T18:19:12 | v0.7.0-rc.22 (#1157)
Includes `rand_core` v0.10.0-rc-6 bump with `(Try)RngCore` => `(Try)Rng`
renames | diff --git a/Cargo.lock b/Cargo.lock
index 6a48b4c..22e52d8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -230,7 +230,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.21"
+version = "0.7.0-rc.22"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
5626eac154bf9e7779fbb130543132b3d347cf5e | Tony Arcieri | 2026-01-24T16:29:15 | Have `Monty::zero` and `Monty::one` borrow params (#1140)
This is more or less a followup to #1087 which had `BoxedMontyForm::new`
auto-clone its params (since it's an `Arc` and that's cheap).
This does the same for these trait methods, where previously to use them
you always had to clone the params yourself. | diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs
index ed73a61..716eff7 100644
--- a/src/modular/boxed_monty_form.rs
+++ b/src/modular/boxed_monty_form.rs
@@ -64,19 +64,19 @@ impl BoxedMontyForm {
/// Instantiates a new `ConstMontyForm` that represents zero.
#[must_use]
- pu... | 6 | 40 | 28 |
628cf8b0194e868acbc848605a062351a5bd18ec | Andrew Whitehead | 2026-01-24T16:09:40 | Extend exponentiation support for `Uint` (#1147)
This changes the `pow` methods in #1081 to accept a `Uint` rather than a
u32, adds support for `saturating_pow`, and implements
`Pow`/`PowBoundedExp` for `Wrapping(Uint)` and `Checked(Uint)`.
Related to #259
---------
Signed-off-by: Andrew Whitehead <cywolf@gmail.com... | diff --git a/benches/uint.rs b/benches/uint.rs
index fbbce08..63dd122 100644
--- a/benches/uint.rs
+++ b/benches/uint.rs
@@ -325,6 +325,30 @@ fn bench_mul(c: &mut Criterion) {
BatchSize::SmallInput,
);
});
+
+ group.bench_function("saturating_pow, U256", |b| {
+ b.iter_batched(
+ ... | 5 | 357 | 70 |
7c9b400433b01d00845b8d2a0a068e53af55b5e7 | Tony Arcieri | 2026-01-24T15:53:50 | Bump `getrandom` to v0.4.0-rc.1 (#1155) | diff --git a/Cargo.lock b/Cargo.lock
index 29d4346..6a48b4c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -236,7 +236,7 @@ dependencies = [
"criterion",
"ctutils",
"der",
- "getrandom 0.4.0-rc.0",
+ "getrandom 0.4.0-rc.1",
"hex-literal",
"hybrid-array",
"num-bigint",
@@ -321,8 +321,9 @@ dependencies = [
[[... | 2 | 5 | 8 |
f69f020e67c115be8626c98472716133f7acdd60 | Tony Arcieri | 2026-01-24T15:13:42 | Bump `rand_core` to v0.10.0-rc.6 (#1154)
This renames `(Try)RngCore` => `(Try)Rng` | diff --git a/Cargo.lock b/Cargo.lock
index 6308fcc..1f81ed2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -23,6 +23,12 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
+[[package]]
+name = "anyhow"
+ver... | 16 | 286 | 60 |
18c8935d7a8a5c2b06115fe5cfcd27256e92d3be | Andrew Whitehead | 2026-01-24T14:19:13 | Additional trait implementations for `Limb` (#1150)
This implements the `BitOps` trait along with `AsRef<[Limb]>`,
`AsMut<[Limb]>`, `AsRef<UintRef>`, `AsMut<UintRef>`.
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/limb.rs b/src/limb.rs
index 7f0995f..af79228 100644
--- a/src/limb.rs
+++ b/src/limb.rs
@@ -21,10 +21,10 @@ mod sub;
mod rand;
use crate::{
- Bounded, Choice, ConstOne, ConstZero, Constants, CtEq, CtOption, NonZero, One, WideWord, Word,
- Zero, word,
+ Bounded, Choice, ConstOne, ConstZero,... | 4 | 297 | 16 |
90173671aa4bb2d598f64401c061edf854f727d8 | Andrew Whitehead | 2026-01-22T21:37:43 | Optimizations and cleanups for Montygomery `pow`/`pow_vartime` (#1138)
In my tests `pow`/`pow_vartime` are improved by about 6-8% for U256.
Replacing `sub_mod_with_carry` also improves other Montygomery
operations like addition by a small percentage.
---------
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/benches/const_monty.rs b/benches/const_monty.rs
index 9c100ae..136762c 100644
--- a/benches/const_monty.rs
+++ b/benches/const_monty.rs
@@ -110,14 +110,26 @@ fn bench_montgomery_ops<M: Measurement>(group: &mut BenchmarkGroup<'_, M>) {
);
});
- group.bench_function("modpow, U256^U256", |b... | 11 | 57 | 34 |
2b9b1e39d3eec9484d22825044e05c1398ec00e5 | Tony Arcieri | 2026-01-21T23:22:54 | Remove APIs for mutably borrowing `NonZero` and `Odd` (#1146)
Such APIs would make it possible to access the inner limbs mutably, in
which case the contained value could be set to zero or an even number,
bypassing the invariants. | diff --git a/src/non_zero.rs b/src/non_zero.rs
index 957134d..6632a2a 100644
--- a/src/non_zero.rs
+++ b/src/non_zero.rs
@@ -296,13 +296,6 @@ impl<const LIMBS: usize> NonZeroUint<LIMBS> {
pub const fn as_uint_ref(&self) -> &NonZeroUintRef {
self.0.as_uint_ref().as_nz_unchecked()
}
-
- /// Mutably ... | 3 | 8 | 150 |
452526886ae7dac8714c5b861b5a822aea93d337 | Tony Arcieri | 2026-01-21T16:15:27 | Factor `*MontyParams` into `modular::monty_params` (#1143)
This is an attempt to further consolidate Montgomery parameters around a
single generic struct, though we still need a separate
`BoxedMontyParams` struct to wrap the generic struct in an `Arc`.
All of the params calculation is now in a single module. Ideally ... | diff --git a/src/modular.rs b/src/modular.rs
index a68a04a..4ef668c 100644
--- a/src/modular.rs
+++ b/src/modular.rs
@@ -43,7 +43,7 @@ pub use self::{
pub(crate) use self::safegcd::SafeGcdInverter;
#[cfg(feature = "alloc")]
-pub use self::boxed_monty_form::{BoxedMontyForm, BoxedMontyParams};
+pub use self::{boxed_m... | 6 | 217 | 211 |
488570377913f3f2b2a390e68761441436b29513 | Tony Arcieri | 2026-01-21T15:32:21 | Add `From<GenericMontyParams<_>>` bound on `Monty::Params` (#1142)
This makes it possible to construct `GenericMontyParams` however you
want, for example using a constant-time constructor, which isn't
currently exposed outside the trait. | diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs
index 62c1c35..141f2db 100644
--- a/src/modular/boxed_monty_form.rs
+++ b/src/modular/boxed_monty_form.rs
@@ -63,7 +63,7 @@ impl BoxedMontyParams {
/// Instantiates a new set of [`BoxedMontyParams`] representing the given `modulus`.
... | 2 | 8 | 1 |
b11fbcc810c9acc8d92a473abb746b8f62d5d04e | Tony Arcieri | 2026-01-20T15:59:59 | Impl `AmmMultiplier` for `DynMontyMultiplier` (#1131)
- Extracts the `almost_montgomery_mul` function into `modular::mul` and
changes its arguments to `UintRef`
- Adds the `AmmMultiplier` impl to `DynMontyMultiplier` which allocates
the product buffer on the stack and calls into `almost_montgomery_mul`
- Wires everyth... | diff --git a/Cargo.toml b/Cargo.toml
index 5005c56..abfe537 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -63,6 +63,7 @@ cast_sign_loss = "warn"
checked_conversions = "warn"
doc_markdown = "warn"
from_iter_instead_of_collect = "warn"
+implicit_saturating_sub = "warn"
manual_assert = "warn"
map_unwrap_or = "warn"
ma... | 13 | 212 | 103 |
e193ed32ff36951789bee78e9ed81a8ddb020fb6 | Tony Arcieri | 2026-01-20T14:43:24 | Bump `rand_core` to v0.10.0-rc-5 (#1136) | diff --git a/Cargo.lock b/Cargo.lock
index 5d1e47b..cc4dfc4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -88,7 +88,7 @@ checksum = "26f659b53b7f4e776e0cb370508f21d62a22349009195b1089de5f9b24afba2f"
dependencies = [
"cfg-if",
"cpufeatures",
- "rand_core 0.10.0-rc-4",
+ "rand_core 0.10.0-rc-5",
]
[[package]]
@@ -... | 2 | 6 | 6 |
61a0acf7e33894685a532aacc8e8e0e339c7b6b1 | Tony Arcieri | 2026-01-20T06:19:59 | CI: adjust `clippy` lints (#1135)
Sets the following to "allow":
- `clippy::many_single_char_names`
- `clippy::needless_range_loop`
Also removes the previous explicit config in the code for these | diff --git a/Cargo.toml b/Cargo.toml
index 6b5dcaa..598faa7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -65,11 +65,13 @@ doc_markdown = "warn"
from_iter_instead_of_collect = "warn"
manual_assert = "warn"
map_unwrap_or = "warn"
+many_single_char_names = "allow"
missing_errors_doc = "warn"
missing_panics_doc = "warn... | 3 | 2 | 3 |
d8158bc880a36a8f559a9ba9f52f45cbd24c779f | Tony Arcieri | 2026-01-20T05:53:25 | Have `pow_montgomery_form_amm` reduce its output (#1133)
Extracts an `almost_montgomery_reduce` function which accepts a `&mut
UintRef` as input and conditionally subtracts the modulus twice, as
explained in extensive comments.
This required porting `conditional_borrowing_sub_assign` to `UintRef`,
as well as adding a... | diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs
index a832af2..62c1c35 100644
--- a/src/modular/boxed_monty_form.rs
+++ b/src/modular/boxed_monty_form.rs
@@ -127,6 +127,12 @@ impl BoxedMontyParams {
}
}
+impl AsRef<GenericMontyParams<BoxedUint>> for BoxedMontyParams {
+ fn as_r... | 12 | 129 | 62 |
bd8a0a41ddeef9af22fdea02d62b9413afa7b08a | Tony Arcieri | 2026-01-20T04:52:07 | Add `Unsigned::as(_mut)_uint_ref` (#1132)
Adds methods for obtaining `UintRef` in addition to the existing
`AsRef<UintRef>` bounds (which might have inference problems), and also
adds an `AsMut<UintRef>` bound to `Unsigned`. | diff --git a/src/traits.rs b/src/traits.rs
index fe183b9..27f69b4 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -167,6 +167,7 @@ pub trait Signed:
/// Unsigned [`Integer`]s.
pub trait Unsigned:
AsRef<UintRef>
+ + AsMut<UintRef>
+ AddMod<Output = Self>
+ BitOps
+ Div<NonZero<Self>, Output = ... | 3 | 24 | 0 |
4f173605b3929fafc5fd733f05f369acd5d5c9f4 | Tony Arcieri | 2026-01-20T03:09:58 | Bump `ctutils` to v0.4 release (#1130)
Release PR: RustCrypto/utils#1410 | diff --git a/Cargo.lock b/Cargo.lock
index f976cff..5d1e47b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,9 +247,9 @@ dependencies = [
[[package]]
name = "ctutils"
-version = "0.4.0-pre.5"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f9648048880cb5c7ac08f184a... | 2 | 3 | 3 |
d6b44947e130fe643167a69c90c3ec3e54a819b3 | Tony Arcieri | 2026-01-20T03:09:45 | `UintRef { limbs: ... }` (#1129)
Changes `UintRef` from a tuple struct to having a `limbs` field like
every other `*Uint` type.
I don't know why I made it a tuple struct in the first place but now the
inconsistency is driving me insane. | diff --git a/src/uint/encoding.rs b/src/uint/encoding.rs
index 02a0f97..2cc077a 100644
--- a/src/uint/encoding.rs
+++ b/src/uint/encoding.rs
@@ -845,7 +845,7 @@ impl RadixDivisionParams {
remain_mut
.leading_mut(RADIX_ENCODING_LIMBS_LARGE - 1)
.copy_from(limbs_... | 14 | 206 | 164 |
8e3092c06410abee0255fad875bdf400c0cc98a1 | Andrew Whitehead | 2026-01-20T02:32:02 | Add `pow_vartime` for `MontyForm`, `ConstMontyForm` (#1118)
This could be further optimized for small exponents where it doesn't
make sense to use a precomputed table. That's probably true for the
non-vartime version as well.
I think this also enables a vartime multi-exponentiation.
---------
Signed-off-by: Andrew ... | diff --git a/src/modular/const_monty_form/pow.rs b/src/modular/const_monty_form/pow.rs
index d6b0662..c34be53 100644
--- a/src/modular/const_monty_form/pow.rs
+++ b/src/modular/const_monty_form/pow.rs
@@ -31,13 +31,31 @@ impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS
exponent_... | 5 | 275 | 76 |
17084ddf534e4b32413cbe98b31e87ffdfd206d1 | Tony Arcieri | 2026-01-20T01:07:50 | Impl `ToOwned<Owned = BoxedUint>` for `UintRef` (#1128)
When the `alloc` feature is enabled, supports boxing `UintRef` using
`to_owned` | diff --git a/src/uint/boxed.rs b/src/uint/boxed.rs
index 0451f40..022c621 100644
--- a/src/uint/boxed.rs
+++ b/src/uint/boxed.rs
@@ -33,7 +33,12 @@ use crate::{
Word, Zero, modular::BoxedMontyForm,
};
use alloc::{boxed::Box, vec, vec::Vec};
-use core::{fmt, iter::repeat, ops::IndexMut};
+use core::{
+ borrow:... | 5 | 50 | 15 |
abb86230639604373e194e32f1c79e006012a938 | Andrew Whitehead | 2026-01-20T00:18:14 | Add `square_repeat_vartime` method for `MontyForm`, `ConstMontyForm` (#1122)
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/modular/const_monty_form/mul.rs b/src/modular/const_monty_form/mul.rs
index f462cd0..8ecb491 100644
--- a/src/modular/const_monty_form/mul.rs
+++ b/src/modular/const_monty_form/mul.rs
@@ -6,7 +6,7 @@ use core::{
};
use crate::{
- modular::mul::{mul_montgomery_form, square_montgomery_form},
+ ... | 5 | 245 | 9 |
94efecc0a6acd1a7eb7967e61485cc3bc72cf06d | Tony Arcieri | 2026-01-19T23:20:36 | v0.7.0-rc.20 (#1125) | diff --git a/Cargo.lock b/Cargo.lock
index ce188a0..f976cff 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.19"
+version = "0.7.0-rc.20"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
99ac3a12b90c6918aa6a738479497f8068eb91fa | Tony Arcieri | 2026-01-19T22:37:25 | Revert "Make vartime inversion return an `Option` instead of `CtOption`" (#1124)
This reverts commit b9ba08f54e9ad95f6f353ed114ce6e25ae6da621 (#1097).
This changed `Invert::invert` trait method to use `ctutils::CtOption`
explicitly.
`elliptic-curve` uses this `Invert` trait to express its inversions,
including the a... | diff --git a/benches/uint.rs b/benches/uint.rs
index 3600373..4119800 100644
--- a/benches/uint.rs
+++ b/benches/uint.rs
@@ -801,7 +801,7 @@ fn bench_invert_mod(c: &mut Criterion) {
loop {
let x = U256::random_from_rng(&mut rng);
let inv_x = x.invert_odd_mod_va... | 11 | 114 | 128 |
69454414f9a2275f8dd6273f3beb342fbd44dc10 | Tony Arcieri | 2026-01-19T21:47:46 | v0.7.0-rc.19 (#1123) | diff --git a/Cargo.lock b/Cargo.lock
index fc90a1c..ce188a0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -82,8 +82,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "chacha20"
-version = "0.10.0-rc.6"
-source = "git+https://github.com/nstilt1/stream-ciphers-rng?bra... | 2 | 7 | 10 |
0b3ed2675754d8a4fc77fe1891e26f83a273e85e | Tony Arcieri | 2026-01-19T21:34:40 | Remove `UintRef::div*` from the public API (#1121)
It would be nice to at least attempt to use `NonZeroUintRef` as the
divisor before we make these public, as it could eliminate a potential
panic condition.
This changes them from `pub` to `pub(crate)` and leaves a TODO comment
to attempt the `NonZeroUintRef` change f... | diff --git a/src/uint/ref_type.rs b/src/uint/ref_type.rs
index 6c5031b..2a456a3 100644
--- a/src/uint/ref_type.rs
+++ b/src/uint/ref_type.rs
@@ -124,7 +124,6 @@ impl UintRef {
}
/// Conditionally assign all of the limbs to the maximum.
- #[cfg(feature = "alloc")]
#[inline]
pub const fn conditio... | 3 | 16 | 10 |
f6248f38b63bce82bcad8b2697f6901a43ed0f1a | Tony Arcieri | 2026-01-19T21:17:01 | `Odd<UintRef>` improvements (#1120)
Similar PR to what #1117 did for `NonZeroUintRef` but for `Odd<UintRef>`
a.k.a. `OddUintRef` (a newly added type alias, as of this PR).
- Adds functions to `UintRef` for obtaining `OddUintRef` in both
constant and variable time
- Adds functions to `OddUint` and `OddBoxedUint` to ob... | diff --git a/src/non_zero.rs b/src/non_zero.rs
index 6528c14..957134d 100644
--- a/src/non_zero.rs
+++ b/src/non_zero.rs
@@ -32,6 +32,9 @@ pub type NonZeroLimb = NonZero<Limb>;
/// Non-zero unsigned integer.
pub type NonZeroUint<const LIMBS: usize> = NonZero<Uint<LIMBS>>;
+/// Non-zero unsigned integer reference.
+... | 5 | 217 | 67 |
30a17ade1e17e69768033a9b7110b0773159a590 | Tony Arcieri | 2026-01-19T20:22:07 | Bump `rand_core` to v0.10.0-rc-4 (#1119) | diff --git a/Cargo.lock b/Cargo.lock
index 23bac74..fc90a1c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -83,12 +83,11 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "chacha20"
version = "0.10.0-rc.6"
-source = "registry+https://github.com/rust-lang/crates.io-index... | 2 | 11 | 8 |
07c7173058ee5b38f1aac26ef2a824b7b6cdf1fb | Tony Arcieri | 2026-01-19T18:06:47 | `NonZero<UintRef>` improvements (#1117)
- Switch from `NonZero<&UintRef>` to `&NonZero<UintRef>` (also `mut`)
- Introduce `UintRef::{as_nz_unchecked, as_mut_nz_unchecked}` as `unsafe
fn` wrappers for the pointer cast to `NonZero`
- Add `NonZeroUint::as(_mut)_nz` and `NonZeroBoxedUint::as(_mut)_nz` as
an infallible way... | diff --git a/src/non_zero.rs b/src/non_zero.rs
index 9a06171..6528c14 100644
--- a/src/non_zero.rs
+++ b/src/non_zero.rs
@@ -2,7 +2,7 @@
use crate::{
Bounded, Choice, ConstOne, Constants, CtAssign, CtEq, CtOption, CtSelect, Encoding, Int, Limb,
- Mul, Odd, One, Uint, Zero,
+ Mul, Odd, One, Uint, UintRef, ... | 2 | 68 | 13 |
eb5610a06b8313037701aaa6d39b21f7ead035c9 | Tony Arcieri | 2026-01-19T16:46:52 | Add `UintRef::{to_nz, to_nz_vartime}` (#1115)
Adds conversion methods for constructing `NonZero<&mut UintRef>` in
constant-time and both `NonZero<&UintRef>` and `NonZero<&mut UintRef>`
in variable time, returning `CtOption` and `Option` respectively.
It's only possible to construct `NonZero<&mut UintRef>` in variable... | diff --git a/src/uint/cmp.rs b/src/uint/cmp.rs
index 9ad587a..9512a7b 100644
--- a/src/uint/cmp.rs
+++ b/src/uint/cmp.rs
@@ -1,35 +1,22 @@
-//! [`Uint`] comparisons.
+//! [`Uint`] comparison operations.
//!
-//! By default, these are all constant-time.
+//! Constant-time unless explicitly noted otherwise.
use super... | 3 | 90 | 19 |
c6b246c198d71ad802d22f876e8489336ab724ce | Tony Arcieri | 2026-01-19T16:13:02 | Add `UintRef` to public API (#1114)
In #812 I removed `UintRef` from the public API to give it some time to
mature (perhaps not super helpful in an unstable development release
series), but it seems mature enough now.
It's very useful to expose as a common abstraction for writing `const
fn` in-place algorithms that w... | diff --git a/src/lib.rs b/src/lib.rs
index 493b644..d369723 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -167,6 +167,7 @@ pub use crate::{
uint::{
div_limb::Reciprocal,
encoding::{EncodedUint, TryFromSliceError},
+ ref_type::UintRef,
*,
},
word::{WideWord, Word},
diff --g... | 13 | 94 | 47 |
c4a8d726b04bd65c14d8302da14c7270847b8735 | Tony Arcieri | 2026-01-19T14:49:44 | Bump `ctutils` to v0.4.0-pre.5 (#1113) | diff --git a/Cargo.lock b/Cargo.lock
index 3348b72..23bac74 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -145,9 +145,9 @@ checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
[[package]]
name = "cmov"
-version = "0.5.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crat... | 2 | 5 | 5 |
abad0f7ac54536f573f3b68d353f52e979181ffb | Tony Arcieri | 2026-01-19T00:51:02 | Cargo.toml: add additional clippy lints (#1111)
Enables a number of casting lints:
- `cast_lossless`
- `cast_possible_truncation`
- `cast_possible_wrap`
- `cast_precision_loss`
- `cast_sign_loss`
Some of these were easily fixable, but for many an `allow` attribute has
been added in a "stop the bleeding" capacity so w... | diff --git a/Cargo.toml b/Cargo.toml
index dc17de6..d49015b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -53,6 +53,11 @@ subtle = ["dep:subtle", "ctutils/subtle", "hybrid-array?/subtle"]
[lints.clippy]
borrow_as_ptr = "warn"
+cast_lossless = "warn"
+cast_possible_truncation = "warn"
+cast_possible_wrap = "warn"
+cas... | 48 | 164 | 58 |
13b9728e514cf0869c191f94ef15377487f75fab | Tony Arcieri | 2026-01-18T21:13:29 | Cargo.toml: fix typo | diff --git a/Cargo.toml b/Cargo.toml
index dee683b..dc17de6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -65,7 +65,7 @@ must_use_candidate = "warn"
implicit_saturating_sub = "warn"
panic_in_result_fn = "warn"
ptr_as_ptr = "warn"
-redundant_closure_for_method-calls = "warn"
+redundant_closure_for_method_calls = "warn"... | 1 | 1 | 1 |
f157844804aea4b1150a08dedd8c94cb9753947d | Tony Arcieri | 2026-01-18T14:34:20 | Remove `BoxedMontyParamsInner` type alias (#1108)
We don't need it and can just use `GenericMontyParams` instead, which is
shorter and one less type name to worry about. | diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs
index a3ea083..5032674 100644
--- a/src/modular/boxed_monty_form.rs
+++ b/src/modular/boxed_monty_form.rs
@@ -24,9 +24,7 @@ use zeroize::Zeroize;
/// Parameters to efficiently go to/from the Montgomery form for an odd modulus whose size and... | 2 | 5 | 7 |
af55806c73389cc5258a152e8fdf91cf73ae2c0f | Tony Arcieri | 2026-01-18T14:18:06 | Unified `GenericMontyParams` (#1107)
Replaces `struct MontyParams` and `struct BoxedMontyParamsInner` with
type aliases for a single struct which is generic around `U: Unsigned`,
as these two types previously had identical structure and only differed
in the unsigned integer type they used.
This makes it possible to c... | diff --git a/src/modular.rs b/src/modular.rs
index 3c64bd0..a68a04a 100644
--- a/src/modular.rs
+++ b/src/modular.rs
@@ -25,6 +25,7 @@ mod reduction;
mod add;
pub(crate) mod bingcd;
mod div_by_2;
+mod monty_params;
mod mul;
mod pow;
pub(crate) mod safegcd;
@@ -35,7 +36,8 @@ pub(crate) mod boxed_monty_form;
pub... | 6 | 147 | 117 |
8154d5bf49fd2f7a75d16171045e560e5c183910 | Tony Arcieri | 2026-01-18T06:14:33 | Add `ctutils` trait impls: `CtAssignSlice`/`CtEqSlice` (#1106)
Also fills in some missing `CtAssign` impls and leverages the new
`CtSelectUsingCtAssign` marker trait.
The `*Slice` impls make it possible to use `CtAssign` and `CtEq` on
`[T]` for the types which impl it in this crate. `Limb` uses an
optimized implement... | diff --git a/Cargo.lock b/Cargo.lock
index 2514708..3348b72 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -145,9 +145,9 @@ checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
[[package]]
name = "cmov"
-version = "0.5.0-pre.2"
+version = "0.5.0"
source = "registry+https://github.com/rust-lan... | 13 | 160 | 81 |
d294367b013225156954be4f6584ac75d78b147c | Andrew Whitehead | 2026-01-18T04:40:08 | Add `floor_root_vartime`, `checked_root_vartime` for `Uint` (#1089)
Related to #1082
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/benches/uint.rs b/benches/uint.rs
index 09dbcb8..b894bf5 100644
--- a/benches/uint.rs
+++ b/benches/uint.rs
@@ -9,6 +9,7 @@ use crypto_bigint::{
};
use rand_core::{RngCore, SeedableRng};
use std::hint::black_box;
+use std::num::NonZeroU32;
fn make_rng() -> ChaCha8Rng {
ChaCha8Rng::from_seed(*b"0... | 6 | 261 | 4 |
7802b174ba80dfca61015c33f213510e96275aba | Andrew Whitehead | 2026-01-18T01:18:52 | Make vartime bit shifts return an `Option` instead of `CtOption` (#1096)
Related to #1046
This also adjusts the `ShlVartime`/`ShrVartime` trait implementations to
use the vartime implementations. They mostly weren't before?
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/int/shl.rs b/src/int/shl.rs
index c1e6463..38f33bb 100644
--- a/src/int/shl.rs
+++ b/src/int/shl.rs
@@ -34,8 +34,12 @@ impl<const LIMBS: usize> Int<LIMBS> {
/// When used with a fixed `shift`, this function is constant-time with respect
/// to `self`.
#[inline(always)]
- pub const fn ... | 12 | 256 | 285 |
b9ba08f54e9ad95f6f353ed114ce6e25ae6da621 | Andrew Whitehead | 2026-01-18T01:15:14 | Make vartime inversion return an `Option` instead of `CtOption` (#1097)
Related to #1046
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/benches/boxed_monty.rs b/benches/boxed_monty.rs
index c15d522..c45a76b 100644
--- a/benches/boxed_monty.rs
+++ b/benches/boxed_monty.rs
@@ -96,6 +96,19 @@ fn bench_montgomery_ops<M: Measurement>(group: &mut BenchmarkGroup<'_, M>) {
)
});
+ group.bench_function(format!("invert_vartime, {U... | 12 | 151 | 108 |
c63ea984af33f9033d372bb890d73c75651fdfd2 | Tony Arcieri | 2026-01-18T01:08:32 | Bump `ctutils` to v0.4.0-pre.2 (#1105)
Notable changes include splitting out a `CtAssign` trait from
`CtSelect`, which is now possible to impl for `UintRef`.
It also includes performance improvements through better code
generation. | diff --git a/Cargo.lock b/Cargo.lock
index 8a326e8..2514708 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -145,9 +145,9 @@ checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
[[package]]
name = "cmov"
-version = "0.5.0-pre.0"
+version = "0.5.0-pre.2"
source = "registry+https://github.com/ru... | 20 | 72 | 46 |
e8672bbaf39c33c3f73450ffbb7e1e128fcd8f1e | Tony Arcieri | 2026-01-17T23:35:13 | Consolidate `ct` modules (#1104)
Consolidates modules containing all constant-time functionality for each
numeric type, including: `Int`, `Uint`, `BoxedUint`, `ConstMontyForm`,
`MontyForm`, and `BoxedMontyForm`.
It's the new home for any `ctutils::Ct*` impls or `subtle` trait impls.
This makes auditing the constant-... | diff --git a/src/int.rs b/src/int.rs
index 0c34255..6dd2604 100644
--- a/src/int.rs
+++ b/src/int.rs
@@ -17,6 +17,7 @@ mod bit_not;
mod bit_or;
mod bit_xor;
mod cmp;
+mod ct;
mod div;
mod div_unsigned;
mod encoding;
@@ -28,7 +29,6 @@ mod mul;
mod mul_unsigned;
mod neg;
mod resize;
-mod select;
mod shl;
mod s... | 28 | 733 | 725 |
f423867690a483a1cb1419b0ceb003e2a3a9cc72 | Tony Arcieri | 2026-01-17T22:53:25 | Add array/slice `Limb` => `Word` cast helpers (#1103)
Adds the following functions which can cast from arrays or slices of
`Limb` to `Word`:
- `Limb::array_as_words`
- `Limb::array_as_mut_words`
- `Limb::slice_as_words`
- `Limb::slice_as_mut_words` | diff --git a/src/limb.rs b/src/limb.rs
index 832c7ea..5fb4805 100644
--- a/src/limb.rs
+++ b/src/limb.rs
@@ -94,6 +94,50 @@ impl Limb {
pub const fn lsb_to_choice(self) -> Choice {
word::choice_from_lsb(self.0)
}
+
+ /// Convert a shared reference to an array of [`Limb`]s into a shared reference t... | 3 | 50 | 20 |
75e45d5dc5581691f21592bc14c4ceddd6f277d3 | Tony Arcieri | 2026-01-17T02:23:05 | Cargo.lock: bump dependencies (#1102)
Updates the following dependencies:
$ cargo update
Updating crates.io index
Locking 48 packages to latest compatible versions
Updating aho-corasick v1.1.3 -> v1.1.4
Updating anstyle v1.0.11 -> v1.0.13
Updating bitflags v2.9.4 -> v2.10.0
Updating bumpa... | diff --git a/Cargo.lock b/Cargo.lock
index 8af450a..8a326e8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 4
[[package]]
name = "aho-corasick"
-version = "1.1.3"
+version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e60d3430d3a69478ad0993f19238d2df97c... | 1 | 119 | 206 |
347583a1ef01513491e0964cb103a033e6e76e80 | Fethbita | 2026-01-15T14:21:04 | Extra sizes `U8320` and `U12288` (#1101)
Adds `U8320` and `U12288` and a way to split `U1152` `U2176` `U3200`
`U4224` `U6272` and `U8320` into `U128`. | diff --git a/src/uint/extra_sizes.rs b/src/uint/extra_sizes.rs
index fb639c7..ad239de 100644
--- a/src/uint/extra_sizes.rs
+++ b/src/uint/extra_sizes.rs
@@ -108,7 +108,9 @@ impl_uint_aliases! {
(U7936, 7936, "7936-bit"),
(U8000, 8000, "8000-bit"),
(U8064, 8064, "8064-bit"),
- (U8128, 8128, "8128-bit")... | 1 | 14 | 1 |
d01e1889d961263a4a00891f23f0a7cef975d0d5 | Tony Arcieri | 2026-01-14T02:05:57 | v0.7.0-rc.18 (#1100) | diff --git a/Cargo.lock b/Cargo.lock
index 4b6172f..8af450a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.17"
+version = "0.7.0-rc.18"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
731e0a7cc0f23e2322aefa1491957eea6df36713 | Tony Arcieri | 2026-01-14T00:43:51 | BoxedMontyForm: `From` conversions for `(Const)MontyForm` (#1099)
Support for converting from `ConstMontyForm` and `MontyForm` into
`BoxedMontyForm`.
This is useful for SRP where I'm trying to use `ConstMontyForm` and
`ConstMontyParams` to represent groups as precomputed constants which
can be converted to the heap a... | diff --git a/src/modular/boxed_monty_form.rs b/src/modular/boxed_monty_form.rs
index e1911af..37c9307 100644
--- a/src/modular/boxed_monty_form.rs
+++ b/src/modular/boxed_monty_form.rs
@@ -2,6 +2,7 @@
mod add;
mod cmp;
+mod from;
mod invert;
mod lincomb;
mod mul;
@@ -10,7 +11,7 @@ mod pow;
mod select;
mod sub;... | 2 | 63 | 22 |
89f888bd9c9bb9c7683f3b221d6ccb7ba6a32f52 | Tony Arcieri | 2026-01-13T23:38:48 | modular: change docs from `impl_modulus!` => `const_monty_params!` (#1098)
Removes a mention of a deprecated macro name in favor of the new one | diff --git a/src/modular.rs b/src/modular.rs
index 809814d..3c64bd0 100644
--- a/src/modular.rs
+++ b/src/modular.rs
@@ -5,11 +5,12 @@
//!
//! # Constant moduli
//!
-//! The [`ConstMontyForm`] and [`ConstMontyParams`] types implement support for modular arithmetic where the
-//! modulus is fixed at compile-time.
+//... | 1 | 5 | 4 |
1e48e69cf1bd6324689bf0e9ae23d20abc05bd65 | Tony Arcieri | 2026-01-13T00:18:56 | Use `core` convention for mixed-sign ops (#1092)
The convention is as follows:
- `{unsigned}::*_signed` for ops that take `{signed}` RHS operand
- `{signed}::*_unsigned` for ops that take `{unsigned}` RHS operand
Previously we used `*_int` and `*_uint` respectively.
The more we align with core, the more operations ... | diff --git a/src/int.rs b/src/int.rs
index b6de0a7..0c34255 100644
--- a/src/int.rs
+++ b/src/int.rs
@@ -18,14 +18,14 @@ mod bit_or;
mod bit_xor;
mod cmp;
mod div;
-mod div_uint;
+mod div_unsigned;
mod encoding;
mod from;
mod gcd;
mod invert_mod;
mod mod_symbol;
mod mul;
-mod mul_uint;
+mod mul_unsigned;
mod ... | 10 | 208 | 176 |
01b964641230005f0807980eab941c72c10481e3 | Tony Arcieri | 2026-01-13T00:00:11 | Add `BoxedUint::overflowing_add` method (#1091)
For closer parity with `core`, this extends `BoxedUint` with an
`overflowing_add` which returns an additional `Choice` which indicates
whether overflow occurred.
It seems we're not entirely consitent with how we define these methods
on some other types, and there's at l... | diff --git a/src/uint/boxed/add.rs b/src/uint/boxed/add.rs
index 5ecb2b7..6abb6a0 100644
--- a/src/uint/boxed/add.rs
+++ b/src/uint/boxed/add.rs
@@ -5,6 +5,7 @@ use crate::{
Uint, Wrapping, WrappingAdd,
};
use core::cmp;
+use ctutils::CtEq;
impl BoxedUint {
/// Computes `self + rhs + carry`, returning th... | 1 | 38 | 16 |
b047ab0a78a6542190b47107ef15be108b110a0b | Tony Arcieri | 2026-01-12T23:24:17 | Add `BoxedUint::concatenating_add` (#1090)
Addition method which returns a result concatenated with one additional
overflow limb which would be returned if `carrying_add` were called with
the same operands. | diff --git a/src/uint/boxed/add.rs b/src/uint/boxed/add.rs
index 240c509..5ecb2b7 100644
--- a/src/uint/boxed/add.rs
+++ b/src/uint/boxed/add.rs
@@ -1,9 +1,10 @@
//! [`BoxedUint`] addition operations.
use crate::{
- Add, AddAssign, BoxedUint, CheckedAdd, Choice, CtOption, CtSelect, Limb, U64, U128, Uint,
- Wr... | 2 | 39 | 9 |
4809559579bb42c15f5f26668da5c0a2613e1aaf | Tony Arcieri | 2026-01-12T19:23:11 | v0.7.0-rc.16 (#1088) | diff --git a/Cargo.lock b/Cargo.lock
index 1e3a8de..f57b86e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.15"
+version = "0.7.0-rc.16"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
ea92dba77f3909ecfa7e4d3bbfbdcc6d7192172c | Andrew Whitehead | 2026-01-12T19:10:37 | Add CheckedSquareRoot trait, related cleanups (#1083)
Related to #1082
Adds a `CheckedSquareRoot` trait and renames the `SquareRoot` to
`FloorSquareRoot`, extending it with an Output type. Associated methods
are renamed, `sqrt -> floor_sqrt` where appropriate.
Implements `CheckedSquareRoot` for `Uint`, `NonZeroUint... | diff --git a/benches/boxed_uint.rs b/benches/boxed_uint.rs
index a38282d..b4fd708 100644
--- a/benches/boxed_uint.rs
+++ b/benches/boxed_uint.rs
@@ -206,18 +206,34 @@ fn bench_boxed_sqrt(c: &mut Criterion) {
let mut group = c.benchmark_group("boxed_sqrt");
let mut rng = ChaCha8Rng::from_seed([7u8; 32]);
- ... | 7 | 435 | 177 |
5126dde09cbc3743e9ca6de1a6af2686f3d3269f | Tony Arcieri | 2026-01-12T18:46:30 | Have `BoxedMontyForm::new` auto-`Clone` its params (#1087)
Changes the `params` argument to `&BoxedMontyParams` and automatically
invokes `Clone` on it, since cloning the inner `Arc` is cheap.
We were otherwise leaving this to the caller to do which is annoying,
especially since it can be automatic.
However, changin... | diff --git a/benches/boxed_monty.rs b/benches/boxed_monty.rs
index 22c33c0..c15d522 100644
--- a/benches/boxed_monty.rs
+++ b/benches/boxed_monty.rs
@@ -26,11 +26,11 @@ fn bench_montgomery_ops<M: Measurement>(group: &mut BenchmarkGroup<'_, M>) {
|| {
let a = BoxedMontyForm::new(
... | 20 | 65 | 66 |
4a514c64850ac39b6f28ecff80373b7c732dd0da | Tony Arcieri | 2026-01-12T17:34:15 | `NonZero` and `Odd` encoding tests (#1086)
...and a few others. This actually caught a bug!
Adds tests for the following:
- `NonZero::{from_be_bytes, from_le_bytes}`
- `NonZero::{from_be_hex, from_le_hex}`
- `NonZero::one`
- `Odd::{from_be_hex, from_le_hex}`
Additionally sprinkles `#[track_caller]` (which was helpfu... | diff --git a/src/non_zero.rs b/src/non_zero.rs
index ca1b74c..0b6eafd 100644
--- a/src/non_zero.rs
+++ b/src/non_zero.rs
@@ -170,6 +170,7 @@ impl NonZero<Limb> {
/// In future versions of Rust it should be possible to replace this with
/// `NonZero::new(…).unwrap()`
// TODO: Remove when `Self::new` and `... | 2 | 109 | 5 |
089525b76e5663a1f824d140e5a2b9423956759f | Tony Arcieri | 2026-01-12T16:39:13 | Improve tests for `Limb::*add` and `Limb::bitxor*` (#1085) | diff --git a/src/limb/add.rs b/src/limb/add.rs
index 84b0a9d..c1b89ba 100644
--- a/src/limb/add.rs
+++ b/src/limb/add.rs
@@ -6,13 +6,6 @@ use crate::{
};
impl Limb {
- /// Computes `self + rhs`, returning the result along with the carry.
- #[inline(always)]
- pub const fn overflowing_add(self, rhs: Limb) -... | 2 | 91 | 8 |
4e920d6a01d829075a132f7c531613404d9c1c4f | Tony Arcieri | 2026-01-12T16:14:37 | Add `BoxedUint::pow_mod` (#1084)
Simplified modular exponentiation interface for cases where it doesn't
make sense to create persistent Montgomery form values (i.e.
`BoxedMontyForm`) | diff --git a/src/uint/boxed.rs b/src/uint/boxed.rs
index 89b8f36..317678c 100644
--- a/src/uint/boxed.rs
+++ b/src/uint/boxed.rs
@@ -17,6 +17,7 @@ mod mul;
mod mul_mod;
mod neg;
mod neg_mod;
+mod pow_mod;
mod select;
mod shl;
mod shr;
diff --git a/src/uint/boxed/pow_mod.rs b/src/uint/boxed/pow_mod.rs
new file mod... | 3 | 31 | 0 |
4c7604eec358af1b3fb89a3a0f2f276e08490ffd | Andrew Whitehead | 2026-01-12T15:48:02 | Add checked and wrapping exponentiation methods for `Uint` (#1081)
This adds `Uint::checked_pow_vartime`, and `Uint::wrapping_pow_vartime`,
both variable time in the exponent (only).
Signed-off-by: Andrew Whitehead <cywolf@gmail.com> | diff --git a/src/uint.rs b/src/uint.rs
index 35f8913..daaa252 100644
--- a/src/uint.rs
+++ b/src/uint.rs
@@ -45,6 +45,7 @@ mod mul_int;
mod mul_mod;
mod neg;
mod neg_mod;
+mod pow;
mod ref_type;
mod resize;
mod select;
diff --git a/src/uint/pow.rs b/src/uint/pow.rs
new file mode 100644
index 0000000..eaf0c61
--- ... | 2 | 100 | 0 |
ba4b2344c5743578e9eaeabc7b8827c92df114d8 | Tony Arcieri | 2026-01-06T16:04:23 | v0.7.0-rc.15 (#1080) | diff --git a/Cargo.lock b/Cargo.lock
index 82901a4..1e3a8de 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.14"
+version = "0.7.0-rc.15"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
cec987e17716892f3f734b6c1624d47ca1af2b23 | Andrew Whitehead | 2026-01-06T14:58:22 | Speedups for `Uint::sqrt`, `Uint::sqrt_vartime` (#1078)
These changes optimize `Uint::sqrt` by operating on a non-zero input,
reducing the number of conditional selects. The initial division
operation for both `sqrt` and `sqrt_vartime` is replaced by a bit shift.
A fast path is added for `sqrt_vartime` when the input ... | diff --git a/benches/uint.rs b/benches/uint.rs
index 47c74b3..c8bd864 100644
--- a/benches/uint.rs
+++ b/benches/uint.rs
@@ -872,6 +872,14 @@ fn bench_sqrt(c: &mut Criterion) {
)
});
+ group.bench_function("sqrt, U512", |b| {
+ b.iter_batched(
+ || U512::random_from_rng(&mut rng),
+... | 2 | 93 | 57 |
61763d43325c11c71561fb93673d79d5635a34b4 | Steven Dee | 2026-01-06T00:44:53 | Reapply "Write `random_mod` in terms of new `random_bits`" (#1079)
Depends on RustCrypto/signatures#1139 as well as potentially changes to
other dependent crates.
Reverts RustCrypto/crypto-bigint#1060 | diff --git a/src/traits.rs b/src/traits.rs
index 5d7d401..a46c792 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -639,7 +639,6 @@ pub trait Encoding: Sized {
/// Byte array representation.
type Repr: AsRef<[u8]>
+ AsMut<[u8]>
- + Copy
+ Clone
+ Sized
+ for<'a> Try... | 5 | 100 | 90 |
04eadf4e0235bf25755b0c600f1bff54cff225c8 | Tony Arcieri | 2026-01-05T04:19:51 | v0.7.0-rc.14 (#1074) | diff --git a/Cargo.lock b/Cargo.lock
index 246d64f..d84be45 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.13"
+version = "0.7.0-rc.14"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
b201dd7c996ed38cca2815fda75db77fc23dd022 | Tony Arcieri | 2026-01-04T17:49:22 | Rename `Uint::gcd_uint(_vartime)` => `::gcd(_vartime)` (#1073)
In this case `self` and `rhs` are both `Uint`, so there's no need for a
`*_uint` to disambiguate the argument type.
This overlaps with the trait impl but has the same signature aside from
being a `const fn`, which is a pattern we use throughout the librar... | diff --git a/benches/uint.rs b/benches/uint.rs
index a124ff5..47c74b3 100644
--- a/benches/uint.rs
+++ b/benches/uint.rs
@@ -4,7 +4,7 @@ use criterion::{
BatchSize, BenchmarkGroup, BenchmarkId, Criterion, criterion_group, criterion_main,
};
use crypto_bigint::{
- Gcd, Limb, NonZero, Odd, OddUint, Random, Rand... | 6 | 39 | 17 |
d07bc289e69f04aeec0ecc13d386689af2c4ab0a | Tony Arcieri | 2026-01-04T16:49:09 | Add `get_copy` method to `NonZero`/`Odd` (#1072)
By adding a `T: Copy` bound, we can have a function equivalent to `get`
which is `const fn`, since `Copy` types are `!Drop` and otherwise `get`
needs to worry about destructors | diff --git a/src/non_zero.rs b/src/non_zero.rs
index c913d5d..ca1b74c 100644
--- a/src/non_zero.rs
+++ b/src/non_zero.rs
@@ -61,6 +61,18 @@ impl<T> NonZero<T> {
pub fn get(self) -> T {
self.0
}
+
+ /// Returns a copy of the inner value for `Copy` types.
+ ///
+ /// This allows the function t... | 2 | 24 | 0 |
30626b454dd18f07c0c9016c4b6ca810103cf0ef | Tony Arcieri | 2026-01-04T16:25:15 | Fix `Default` impl for `Odd` (#1071)
It was previously derived, which would use the `Default` impl of the
underlying `T` which, in almost every case, will return zero, violating
the invariant of the type.
This adds a custom `Default` impl similar to the one on `NonZero` which
is bounded on `One` trait, and returns `O... | diff --git a/src/non_zero.rs b/src/non_zero.rs
index 1bedeb3..c913d5d 100644
--- a/src/non_zero.rs
+++ b/src/non_zero.rs
@@ -322,11 +322,11 @@ where
impl<T> Default for NonZero<T>
where
- T: Constants,
+ T: One,
{
#[inline]
fn default() -> Self {
- Self(T::ONE)
+ Self(T::one())
}... | 2 | 25 | 3 |
613a471aa778b03cd00f49bf9670be25789a0a94 | Tony Arcieri | 2025-12-29T23:14:53 | v0.7.0-rc.13 (#1069) | diff --git a/Cargo.lock b/Cargo.lock
index 74d9472..246d64f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.12"
+version = "0.7.0-rc.13"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
2b7e4609f26287bc694f11034d501d72ebd53571 | Tony Arcieri | 2025-12-29T23:02:54 | Improve `EncodedUint` array conversions (#1068)
- Uses the same trick as `Array` to write bespoke `From` impls for
`EncodedUint`, for all the sizes we do currently special-case
- Updates the `Array` impls to be defined in the same macro we already
use for writing size-specific impls anyway | diff --git a/src/array.rs b/src/array.rs
index 1e4ef76..312e6ef 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -1,8 +1,8 @@
//! Interop support for `hybrid-array`
-use crate::{EncodedUint, Encoding, Integer, Limb};
+use crate::{Encoding, Integer};
use core::ops::Add;
-use hybrid_array::{Array, ArrayN, ArraySize, t... | 4 | 73 | 63 |
1cae8016102592d59994d58aa320772ff5aca563 | Tony Arcieri | 2025-12-29T22:43:34 | Bump `ctutils` v0.3.0 (#1067)
This notably removes the `(Partial)Eq` impl(s) from `Choice`, so
anywhere affected has been updated to use e.g. `to_bool` instead. | diff --git a/Cargo.lock b/Cargo.lock
index 29a5e65..74d9472 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,9 +247,9 @@ dependencies = [
[[package]]
name = "ctutils"
-version = "0.2.3"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d0d4ebbcf0ee8b260dd060b79b74499... | 16 | 143 | 120 |
f8f09a143353de02dc97223e449620dc2d7879c9 | Tony Arcieri | 2025-12-29T20:30:30 | Add `EncodedUint::as_(mut_)slice` (#1065)
Adds inherent `const fn` accessors for the contents of an `EncodedUint`.
Notably without these, there was no way to access the contents at all
from within a `const fn`. | diff --git a/src/uint/encoding.rs b/src/uint/encoding.rs
index bd6b3e6..b70243e 100644
--- a/src/uint/encoding.rs
+++ b/src/uint/encoding.rs
@@ -236,6 +236,16 @@ const fn cast_slice_mut(limbs: &mut [Word]) -> &mut [u8] {
}
impl<const LIMBS: usize> EncodedUint<LIMBS> {
+ /// Extracts a byte slice containing the e... | 1 | 12 | 2 |
1ebbd8b5a54998d5ca646772574eb8d350329b52 | Tony Arcieri | 2025-12-29T19:31:53 | Add `From` impls between `ByteArray` and `EncodedUint` (#1064)
One thing lost from #1016 is the ability to convert from `Uint::Repr`
and `hybrid_array::Array<u8, _>`.
Arguably these cases should use the dedicated
`ArrayEncoding`/`ArrayDecoding` traits for this purpose instead, but for
the sake of retrofitting the cha... | diff --git a/src/array.rs b/src/array.rs
index 312e6ef..1e4ef76 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -1,8 +1,8 @@
//! Interop support for `hybrid-array`
-use crate::{Encoding, Integer};
+use crate::{EncodedUint, Encoding, Integer, Limb};
use core::ops::Add;
-use hybrid_array::{Array, ArraySize, typenum::... | 1 | 57 | 2 |
21cef5bd812047b68ccc2c3db40bdcae12891aa9 | Tony Arcieri | 2025-12-29T18:26:09 | Bump `ctutils` to v0.2.3 (#1063)
Handles the deprecation of `Choice::new`
Also adds a `Limb::lsb_to_choice` convenience method, uses it in the
implementation, and makes it public because it might be handy elsewhere. | diff --git a/Cargo.lock b/Cargo.lock
index 30e21ab..29a5e65 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,9 +247,9 @@ dependencies = [
[[package]]
name = "ctutils"
-version = "0.2.2"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "925ebe186f09a7894817213f89eae07c... | 7 | 12 | 7 |
f017aa8a3c787dcdf189a16216148e98003a849f | Tony Arcieri | 2025-12-29T15:51:04 | v0.7.0-rc.12 (#1062) | diff --git a/Cargo.lock b/Cargo.lock
index 37e8ecd..30e21ab 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.11"
+version = "0.7.0-rc.12"
dependencies = [
"chacha20",
... | 2 | 2 | 2 |
86b048078d1252c8ae2cc83f695a50ffe321c5e7 | Tony Arcieri | 2025-12-29T15:37:31 | Remove `derive(Hash)` on `BoxedUint` (#1061)
As noted in #1031 and as identifiable via clippy, the `Hash` impl does
not align with the (Partial)`Eq` impl.
Rather than actually fixing the problem, this PR opts to remove the
`Hash` impl until it can be added back correctly. | diff --git a/src/uint/boxed.rs b/src/uint/boxed.rs
index 5422fe3..89b8f36 100644
--- a/src/uint/boxed.rs
+++ b/src/uint/boxed.rs
@@ -45,8 +45,7 @@ use zeroize::Zeroize;
/// Unlike many other heap-allocated big integer libraries, this type is not
/// arbitrary precision and will wrap at its fixed-precision rather than... | 1 | 1 | 2 |
bcef0142e5aa506af844b62cbd50e428950f57fb | Tony Arcieri | 2025-12-29T15:30:54 | Revert "Write `random_mod` in terms of new `random_bits`" (#1060)
This reverts commit ba4f0e08c1d639b5713506859360a55fd0ea1548 (#1026)
For whatever reason this breaks the `dsa` test suite.
I'm in the middle of a major refactoring in `crypto-bigint` and this
took quite a bit of bisecting to figure out on top of all o... | diff --git a/src/traits.rs b/src/traits.rs
index a46c792..5d7d401 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -639,6 +639,7 @@ pub trait Encoding: Sized {
/// Byte array representation.
type Repr: AsRef<[u8]>
+ AsMut<[u8]>
+ + Copy
+ Clone
+ Sized
+ for<'a> Try... | 5 | 90 | 100 |
34a24b7931cee35fcf510c544a748ee057fa7be2 | Tony Arcieri | 2025-12-29T03:31:30 | v0.7.0-rc.11 (#1059)
This release notably includes a migration from `subtle` to `ctutils`,
with feature-gated backwards compatibility for `subtle`. | diff --git a/Cargo.lock b/Cargo.lock
index 813e5a4..37e8ecd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
-version = "0.7.0-rc.10"
+version = "0.7.0-rc.11"
dependencies = [
"chacha20",
... | 2 | 5 | 5 |
c514faa6fa0a2463b3ff55920a086dd551e8f1a8 | Tony Arcieri | 2025-12-29T03:20:16 | Rename `rand` feature to `rand_core` (#1058)
This crate previously had *both* a `rand` and `rand_core` feature, where
`rand_core` enabled most functionality, but a small amount was gated
under `rand` for no particular reason.
This renames those usages to `rand_core`, and the feature overall, which
follows the general... | diff --git a/Cargo.toml b/Cargo.toml
index cea976d..0288838 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,12 +41,12 @@ proptest = "1.9"
rand_core = "0.10.0-rc-3"
[features]
-default = ["rand"]
+default = ["rand_core"]
alloc = ["serdect?/alloc"]
extra-sizes = []
-getrandom = ["dep:getrandom", "rand"]
-rand = [... | 13 | 20 | 20 |
e975d9dd8924d458e68f568e3d889cc7f992e476 | Tony Arcieri | 2025-12-28T19:08:07 | Use `ConstChoice` for all traits (notably `BitOps`) (#1050)
Gets rid of the lingering usages of `Choice` in the traits this crate
defines in `traits.rs`.
(There are still usages of `CtOption` to remove) | diff --git a/src/int.rs b/src/int.rs
index ca1baeb..3a42078 100644
--- a/src/int.rs
+++ b/src/int.rs
@@ -264,17 +264,16 @@ impl<const LIMBS: usize> Integer for Int<LIMBS> {
impl<const LIMBS: usize> Signed for Int<LIMBS> {
type Unsigned = Uint<LIMBS>;
- fn abs_sign(&self) -> (Uint<LIMBS>, Choice) {
- l... | 7 | 40 | 44 |
74e3520950754ddf9d6176f0f986a882d1739ecd | Tony Arcieri | 2025-12-28T18:39:25 | Impl and bound `Integer` on `CtGt`/`CtLt` (#1049)
Replaces the previous bounds on `subtle::ConstantTimeGreater` and
`ConstantTimeLess` with `ctutils::{CtGt, CtLt}`.
The old `subtle` trait impls are retained but no longer used in bounds.
One step closer to making `subtle` optional. | diff --git a/src/int/cmp.rs b/src/int/cmp.rs
index f30ff5b..31b37b0 100644
--- a/src/int/cmp.rs
+++ b/src/int/cmp.rs
@@ -2,9 +2,8 @@
//!
//! By default, these are all constant-time.
-use crate::{ConstChoice, CtEq, Int, Uint};
+use crate::{ConstChoice, CtEq, CtGt, CtLt, Int, Uint};
use core::cmp::Ordering;
-use sub... | 6 | 101 | 48 |
2c51c70008f8c56ed893c718bca9c4546f80c64e | Tony Arcieri | 2025-12-28T16:56:12 | Replace `ConstantTimeEq` with `CtEq` in trait bounds (#1048)
Changes all of the traits in `traits.rs`, most notably the `Integer`,
`Zero`, and `One` traits, to use `ctutils::CtEq` instead of
`subtle::ConstantTimeEq`, as part of a larger overall migration to
`ctutils` (see also #1040, #1043) | diff --git a/src/checked.rs b/src/checked.rs
index 23c3caf..f4205b7 100644
--- a/src/checked.rs
+++ b/src/checked.rs
@@ -1,6 +1,6 @@
//! Checked arithmetic.
-use crate::{CheckedAdd, CheckedDiv, CheckedMul, CheckedSub};
+use crate::{CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, ConstChoice, CtEq, CtSelect};
use co... | 30 | 274 | 146 |
39644d822c8e27977a19ef76c530613f521e82f2 | Tony Arcieri | 2025-12-28T06:54:06 | Bump `ctutils` to v0.2.1 (#1047)
Includes important security fixes. See RustCrypto/utils#1304.
Fortunately `ctutils` was just introduced into the codebase in the past
week or so and has not made it into any release or prerelease version,
so there is no security impact for this project. | diff --git a/Cargo.lock b/Cargo.lock
index e500006..ea37d57 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -145,9 +145,9 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "cmov"
-version = "0.4.2"
+version = "0.4.3"
source = "registry+https://github.com/rust-lang/crat... | 2 | 5 | 5 |
1ac4246e0c211b67c587e20b4efc792939498d5d | Tony Arcieri | 2025-12-27T16:29:01 | Bump `ctutils` to v0.2 (#1045)
Renames `Choice::from_*_nonzero` => `Choice::from_*_nz` | diff --git a/Cargo.lock b/Cargo.lock
index 8732e9b..e500006 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -145,9 +145,9 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "cmov"
-version = "0.4.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crat... | 10 | 13 | 13 |
d7dd34d38af93a2f8e741376290b797af6b57e92 | Tony Arcieri | 2025-12-27T06:23:05 | word: cleanup helper functions (#1044)
Cleans up the internal helper functions in the `word` module, adding a
`choice_from_*` prefix to functions that return a `Choice`, and getting
rid of `*word*` in the function name since it's implicit from the
`word::*` prefix which is used ubiquitously when calling these
function... | diff --git a/src/int/mod_symbol.rs b/src/int/mod_symbol.rs
index 33a57cd..9a9c14e 100644
--- a/src/int/mod_symbol.rs
+++ b/src/int/mod_symbol.rs
@@ -11,7 +11,7 @@ impl<const LIMBS: usize> Int<LIMBS> {
let (abs, sign) = self.abs_sign();
let jacobi = abs.jacobi_symbol(rhs) as i64;
// (-self|rhs... | 20 | 113 | 116 |
c5c8152c165ec57bee93c677ac2d46c6d4867088 | Tony Arcieri | 2025-12-27T04:45:11 | Replace `ConstantTimeSelect` with `ctutils::CtSelect` (#1043)
The `ConstantTimeSelect` trait was a workaround for having a trait-based
API that works for `Boxed*` and non-boxed types, since we can't impl
`subtle::ConditionallySelectable` on `Boxed*` types since it has a
`Copy` bound.
`ctutils::CtSelect` accomplishes ... | diff --git a/src/lib.rs b/src/lib.rs
index 91f7848..3c94961 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -193,7 +193,7 @@ pub use crate::{
};
// TODO(tarcieri): get rid of `Const*` prefix
-pub use ctutils::{Choice as ConstChoice, CtOption as ConstCtOption};
+pub use ctutils::{Choice as ConstChoice, CtOption as Const... | 8 | 40 | 87 |
3b6064eae61493e634bb60a75f2ec9ffec9fd652 | Tony Arcieri | 2025-12-27T04:07:07 | word: delegate some ops to `ctutils::Choice` (#1042)
Conditionally calls certain `u32`/`u64`/`u128` bit twiddling operations
defined on `ctutils::Choice` based on `target_pointer_width`, rather
than duplicating non-trivial implementations in `ctutils`.
This also goes ahead and bumps to the `ctutils` v0.1.2 crate rele... | diff --git a/Cargo.lock b/Cargo.lock
index 72b0333..8732e9b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -246,8 +246,9 @@ dependencies = [
[[package]]
name = "ctutils"
-version = "0.1.1"
-source = "git+https://github.com/RustCrypto/utils#533ac35fb7dec96f935c2b060a0047a93d72e846"
+version = "0.1.2"
+source = "registr... | 3 | 61 | 53 |
cce7cc70fd957c3b1db0600f7a4ffd18d3d95873 | Tony Arcieri | 2025-12-27T03:23:08 | Factor `ct` module into `primitives` (#1041)
It only contained `u32_max` and `u32_min` at this point, so this moves
them to `primitives` with similar low-level free functions | diff --git a/src/ct.rs b/src/ct.rs
deleted file mode 100644
index 64b9052..0000000
--- a/src/ct.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-pub use ctutils::Choice as ConstChoice;
-pub use ctutils::CtOption as ConstCtOption;
-
-/// `const` equivalent of `u32::max(a, b)`.
-pub const fn u32_max(a: u32, b: u32) -> u32 {
- Const... | 11 | 43 | 47 |
613b88bff56129550be499714f014b4048b5dddb | Tony Arcieri | 2025-12-26T19:56:57 | Use `ctutils` v0.1.1 crate release (#1039)
This is the first version that has all of the functionality we need on
the `Choice` type | diff --git a/Cargo.lock b/Cargo.lock
index 0b1c5e9..15e28d4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -246,8 +246,9 @@ dependencies = [
[[package]]
name = "ctutils"
-version = "0.1.0"
-source = "git+https://github.com/RustCrypto/utils#5d2e2fd107c46d0ed20d54e0014eb43176672f3d"
+version = "0.1.1"
+source = "registr... | 2 | 4 | 6 |
3013e50eed2f641d9a676ea95dbf905e5baad479 | Tony Arcieri | 2025-12-26T17:19:39 | Bump `rand_core` dependency to v0.10.0-rc-3 (#1038) | diff --git a/Cargo.lock b/Cargo.lock
index 8ca1b05..0b1c5e9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -82,13 +82,13 @@ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "chacha20"
-version = "0.10.0-rc.5"
+version = "0.10.0-rc.6"
source = "registry+https://github.co... | 2 | 9 | 9 |
73bf6b2fcd56782b8ffa0c426e1842fc47b86996 | Tony Arcieri | 2025-12-20T04:53:21 | Remove `ConstChoice::is_true_vartime` (#1034)
The `to_bool_vartime` and `is_true_vartime` methods duplicate each
other, performing the same function.
I picked `to_bool_vartime` to consolidate on. | diff --git a/src/const_choice.rs b/src/const_choice.rs
index 67dbfa8..e4579b6 100644
--- a/src/const_choice.rs
+++ b/src/const_choice.rs
@@ -241,21 +241,16 @@ impl ConstChoice {
x & self.as_u32_mask()
}
+ /// WARNING: this method should only be used in contexts that aren't constant-time critical!
... | 14 | 48 | 53 |
5216e2313eaebfec06f308b54f6df10d133b3958 | Fethbita | 2025-12-18T17:44:15 | Add `Uint::lcm` (#1028) | diff --git a/src/uint.rs b/src/uint.rs
index a5276cd..e2d376e 100644
--- a/src/uint.rs
+++ b/src/uint.rs
@@ -41,6 +41,7 @@ pub(crate) mod encoding;
mod from;
pub(crate) mod gcd;
mod invert_mod;
+pub(crate) mod lcm;
mod mod_symbol;
pub(crate) mod mul;
mod mul_mod;
diff --git a/src/uint/lcm.rs b/src/uint/lcm.rs
new... | 3 | 96 | 1 |
dd775d2ae15a09c6c9bab92e7a983275a1bd019b | Tony Arcieri | 2025-12-18T15:14:27 | Remove `bincode` dev-dependency (#1033)
`bincode` is unmaintained. See https://crates.io/crates/bincode/3.0.0 | diff --git a/Cargo.lock b/Cargo.lock
index 11d65cd..af5ec0a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -35,26 +35,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b59d472eab27ade8d770dcb11da7201c11234bef9f82ce7aa517be028d462b"
-[[package]]
-name = "bincode"
-ver... | 8 | 0 | 217 |
e4e1819ef1f6461bfaf90abf296ab490d92ef343 | Steven Dee | 2025-12-14T14:57:18 | Rename `random_mod` ↦ `random_mod_vartime` (#1030)
Rejection sampling means that `random_mod` is inherently variable-time,
and the current name violates the contract in the `README`:
> All functions contained in the crate are designed to execute in
> constant time unless explicitly specified otherwise (via a `*_varti... | diff --git a/benches/boxed_monty.rs b/benches/boxed_monty.rs
index c3555eb..22c33c0 100644
--- a/benches/boxed_monty.rs
+++ b/benches/boxed_monty.rs
@@ -25,11 +25,11 @@ fn bench_montgomery_ops<M: Measurement>(group: &mut BenchmarkGroup<'_, M>) {
b.iter_batched(
|| {
let a = BoxedM... | 17 | 134 | 98 |
ba4f0e08c1d639b5713506859360a55fd0ea1548 | Steven Dee | 2025-12-10T18:38:31 | BREAKING: Write `random_mod` in terms of new `random_bits` (#1026)
## Breaking changes
- `Encoding::Repr` is no longer required to implement `Copy`, so
consumers of `Encoding::Repr` will need to explicitly call `clone`.
- The numbers produced by both `random_bits` and `random_mod` will
generally be different, and ca... | diff --git a/src/traits.rs b/src/traits.rs
index efdb1e2..18ddb68 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -641,7 +641,6 @@ pub trait Encoding: Sized {
/// Byte array representation.
type Repr: AsRef<[u8]>
+ AsMut<[u8]>
- + Copy
+ Clone
+ Sized
+ for<'a> Try... | 5 | 94 | 84 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.