All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
#[inline]attributes for shift and wrapping arithmetic ops (#1229)MontyForm::{is_zero, is_one}methods (#1230)Gcdsupertrait bound toUnsigned/Signedtraits (#1231)
- Define
Uintdivision traits generically (#1232) - Use generic implementation of bit operations for
Wrapping(#1235) - Explicitly seal
MontyForm(#1237)
InverttoMontyFormsupertraits (#1226)
- BREAKING: seal the
Integertrait (#1227)
NOTE: this release, like v0.7.0, was yanked due to last-minute breaking changes, namely sealing the
Integer trait (#1227), which is technically a breaking change but one we do not expect will
have any user-facing impact.
Uint::{concat_resize, concat_checked, split_resize, split_checked}methods (#1223)
PrimeParamsnow requires a multiplicative generator value (#1221)- Improve performance of Monty
pow/pow_vartime(#1222)
NOTE: this release was yanked due to some last minute breaking-changes introduced in v0.7.1,
namely an additional parameter added to const_prime_monty_params! / PrimeParams.
- Binary GCD algorithm (#755)
- Provide
RandomMod::try_random_modandRandom::try_randommethods (#770) Monty::div_by_2_assign()(#777)BoxedUint::inv_mod2k_vartime()(#777)BoxedUint::inv_mod2k()(#777)Monty::Multiplier(#777)serdesupport for BoxedUint (#789)Binary,LowerHex, andUpperHexbounds forInteger(#792)DivVartimetrait (#800)PartialOrd<Uint>impl forBoxedUint(#803)UintReftype (#806, #1114)Resizetrait (#809)Invert::invert_vartimemethod (#814)From<Odd>forNonZeroimpl (#821)BoxedUint::{to_be_bytes_trimmed, to_le_bytes_trimmed}(#824)BoxedUint::{from_be_slice_vartime, from_le_slice_vartime}(#833)Int::to_uintandUint::to_int(#837)NonZeroandOddtype aliases (#844)NonZeroUint/OddUintNonZeroBoxedUint/OddBoxedUintNonZeroInt/OddInt(#845)
NonZeroInt::new_unwrap(#857)- Classic Binary Extended GCD algorithm (#854)
Xgcdtrait (#855)Uint::rem_wide(#896)Reducetrait (#887, #906)SquareModtrait (#915)JacobiSymbolcalculation (#927)NonZero::<Uint>::{from_be_hex, from_le_hex}(#928)SignedandUnsignedmarker traits (#942)Int::wrapping_mul(#946)Onetrait alaZero(#947)MontyParams::{one, r2}accessor methods (#948)- Optimized Binary Extended GCD a.k.a. binxgcd (#945)
ConstMontyForm::MODULUSconstant (#982)Uint::lcmmethod (#1028)getrandomfeature withRandomtrait support (#1057)NonZero::get_copy/Odd::get_copy(#1072)- Checked and wrapping exponentiation methods for
Uint(#1081) CheckedSquareRoottrait (#1083)BoxedUint::pow_modmethod (#1084)BoxedUint::concatenating_addmethod (#1090)BoxedUint::overflowing_addmethod (#1091)- Extra sizes
U8320andU12288(#1101) Limb::array_as_(mut_)words/slice_as_(mut_)words(#1103)Uint::{floor_root_vartime, checked_root_vartime}(#1089)(Const)MontyForm::pow_vartime(#1118)(Const)MontyForm::square_repeat_vartimemethod (#1122)ToOwned<Owned = BoxedUint>impl forUintRef(#1128)BoxedUintexponentiation methods:wrapping_pow,wrapping_pow_bounded_exp,wrapped_pow_vartimeas well aschecked_*/saturating_*equivalents (#1159)- Division and remainder operations for
Limb(#1162) - Implement
IntegerandUnsignedforLimb(#1174) - Mixed-size comparisons for
Integertypes (#1184) MontyParamsgetter methods (#1188)Uint::resize_checkedmethod (#1194)const_prime_monty_params!macro andPrimeParamstrait (#1139)ConcatenatingSquaretrait (#1208)
- Bump
derto v0.8 (#763, #1206) - Bump edition to 2024; MSRV 1.85 (#772)
- Bound
MontyonRetrieve(#797) Uint::div/Int::divnow accept differently sized denominators (#799)- Rename
as_(limbs|words)_mut=>as_mut_(limbs|words)(#805) - Inversion method naming: (#816)
inv()->invert(),inv_mod()->invert_mod(),InvMod->InvertModinv_odd_mod()->invert_odd_mod()inv_mod2k()->invert_mod2k()
- Adopt
corenaming conventions for bigint methods (#817)- Rename
WideningMul->ConcatenatingMul,widening_mul()->concatenating_mul() - Rename
mul_wide()/split_mul()->widening_mul() - Rename
adc()->carrying_add() - Rename
sbb()->borrowing_sub() - Rename
mac()->carrying_mul_add()and change the order of arguments to matchcore
- Rename
- Rename
impl_modulus!=>const_monty_params!(#861) - Unify
ConstMontyParamsandMontyParams(#873) BoxedUint::div_remnow accepts mixed sized inputs (#902)const_monty_form!now defines a type alias (#909)- Modular operations now accept a
NonZeromodulus (#914) - Simplify
Uint::add_mod,Uint::double_mod(#917) Uint::double_modnow requires aNonZeromodulus (#917)- Bump
hybrid-arrayto v0.4 (#934) - Implement
Encodingfor allUints (#1016, #1064) - Rename
random_mod->random_mod_vartime(#1030) - Replace
subtlewithctutils: - Rename
randfeature torand_core(#1058) - Have
BoxedMontyForm::newauto-Cloneits params (#1087) - Rename
SquareRoottrait toFloorSquareRoot(#1083) - Use
coreconvention for mixed-sign op names (#1092){unsigned}::*_signedfor ops that take{signed}RHS operand{signed}::*_unsignedfor ops that take{unsigned}RHS operand
- Make vartime bit shifts return an
Optioninstead ofCtOption(#1096) - Make vartime inversion return an
Optioninstead ofCtOption(#1097) - Unified
MontyParams(#1107) - Have
Monty::zeroandMonty::oneborrow params (#1140) - Rename
MontyForm->FixedMontyForm(#1145) - Split
UnsignedWithMontyFormout ofUnsigned(#1156, #1189) - Bump
rand_coreto v0.10 (#1165) - Wrapping shifts renamed to unbounded shifts to follow
coresemantics (#1160) - Replace
nlimbs!macro withconst fn nlimbs()(#1169) - Use
cpubitscrate for 32-bit vs 64-bit selection (#1170) - More flexible
BoxedUintaddition, subtraction, multiplication (#1177) - Lighter-weight support for
Uintconcat/split operations (#1191) - Deprecate
Uint:{square, square_wide}in favor ofconcatenating_square(#1207) - Deprecate
BoxedUint::{mul, square}in favor of concatenating mul/square (#1208)
- Make
random_bits_coreplatform independent (#781, #1010, #1026) Defaultimpl forOdd(#1071)NonZero::from_le_byte_array(#1211)
PrecomputedInverterandInvertertraits (#894)BoxedMontyFormInverter(#897)*SafeGcdInverter(#898)modular::montgomery_reduction(#900)ConstMontyParams::inverter(#907)ConstMontyFormInverter(#908)
?Sizedto all RngCore bounds (#760)
- Make
as_limbs_mutconst (#757) - Impl
RemMixedfor even splits as well (#791) - Make
Integerbefmt::Binary,LowerHex, andUpperHex(#792)
TryFrom<&[u8]>bound onEncoding::Repr(#261)- New
Uintfunctionality: - New
BoxedUintfunctionality:- New methods:
sbb/wrapping_sub/checked_sub(#303),mul(#306),from_be_slice/from_le_slice(#307),to_be_bytes/to_le_bytes(#308),bits(#328),conditional_select(#329),shl_vartime(#330),shr_vartime(#331),rem_vartime(#332),inv_mod2k/bitor(#334),pow(#337),inv_mod(#341),random(#349),cond_map/cond_and_then(#352),map_limbs(#357),div_rem/rem(#398),new_with_arc(#407),gcd(#497),from_str_radix_vartime(#603),to_string_radix_vartime(#659) - New trait impls:
BitAnd*(#314),ConstantTimeGreater/Less/PartialOrd/Ord(#316),AddMod(#317),SubMod(#320),Hash/BoxedUint(#350),MulMod/BoxedUint(#343),RandomMod(#349),Rem(#356),BitNot/BitXor(#358),CheckedMul/Mul(#361),NegMod(#362),Div(#366),Integer(#367) - Montgomery multiplication support (#323)
- New methods:
- New traits:
FixedInteger(#363),CheckedDiv(#369),WideningMul(#371),ConstantTimeSelect(#454),SquareAssign(#431),Gcd(#499),DivRemLimb/RemLimb(#496),InvMod(#505, #741),SquareRoot(#508),BitOperations(#507),ShrVartime/ShlVartime(#509),RandomBits(#510),RemMixed(#746) num-traitsimpls:Wrapping*(#425),Zero/One(#433),ConstZero(#573),Num(#720)- safegcd (Bernstein-Yang) GCD + inv mod algorithm (#372, #493, #632, #635, #655)
- Constant-time square root and division (#376)
- Implement
ZeroizeforNonZerowrapper (#406) Zero::set_zeromethod (#426)Inverter/PrecomputeInvertertraits (#438, #444)- Uint:
const fnencoders (#453) - Traits to connect integers and Montgomery form representations (#431):
Integer::Montyassociated typeMontytrait with arithmetic bounds and an associatedMonty::Integertype
Oddwrapper type (#487)NonZero::new_unwrap(#602)- Implement Karatsuba multiplication for
UintandBoxedUint(#649) - Efficient linear combination for Montgomery forms (#666)
- Doc comment support for
impl_modulus!(#676) core::error::Errorsupport (#680)Inttype providing initial signed integer support using two's complement (#695, #730)- Variable-time modular inversion support (#731)
- Toplevel
modularmodule now contains all modular functionality (#300, #324) Integertrait: expand bounds to include*Mod(#318),Add/Sub/Mul(#435),RemAssign(#709),AddAssign/MulAssign/SubAssign(#716)Integertrait: add new methodsbits(_vartime)/leading_zeros(#368),from_limb_like/one_like/zero_like` (#533)- Replace
BoxedUint::newwith::zero_with_precision(#327) - Split
Zerotrait intoZero+ZeroConstant(#335) - Refactor
Integertrait; addConstants/LimbsConstant(#355)- The existing
Boundedtrait subsumesBITS/BYTES ConstantsprovidesONEandMAXLimbsConstantprovidesLIMBS
- The existing
- Rename
BoxedUint::mul_widetomul(#359) - Round up
bits_precisionwhen creatingBoxedUint(#365) - Make bit ops use
u32for shifts and bit counts (#373) - Align with
core/stdon overflow behavior for bit shifts (#395) - Make
inv_mod2k(_vartime)return aCtChoice(#416) - Rename
CtChoicetoConstChoice(#417) - Make division methods take
NonZero-wrapped divisors (#419) - Align with
core/stdonoverflowing_sh*for functions which return an overflow flag (#430) Uint: renameHLIMBStoRHS_LIMBS(#432)- Bring
Checked*traits in line withWrapping*(#434) - Rename
*Residue*types i.e. Montgomery form representations (#485):Residue->ConstMontyFormDynResidue->MontyFormBoxedResidue->BoxedMontyForm*ResidueParams->*MontyParamsresidue_params->paramsparams.r->params.one
- Make
Monty::new_params()take anOdd-wrapped modulus (#488) - Expand
Uintsupport forconst fn:square(#514),widening_mul(#515),to_le_bytes(#555) - Have
(Boxed)MontyParams::modulusreturn&Odd<_>(#517) - Split
MontyParams::newandnew_vartime([#516], #518) - Reverse
Concat(Mixed)/Split(Mixed)argument ordering (#526) - Migrate from
generic-arraytohybrid-array(#544) - Replace
ZeroConstantwithConstZerotrait fromnum-traits(#546, #573) - Change
Uint::concat_mixedandsplit_mixedto acceptself; makepub(#556, #558) - Make
Uint::concatandsplitconst generic over inputs (#557, #558) - Split
Uint::mul_modandUint::mul_mod_vartime(#623) - Faster constant-time division (#643)
BoxedMontyForm: always useArcforparams(#645)- Leverage
const_mut_refs; MSRV 1.83 (#667) - Bump
rlpdependency from 0.5 to 0.6 (#673) - Require
RngCoreinstead ofCryptoRngCorefor various random methods (#710) - Bump
serdectdependency to v0.3 (#719) - Have
randfeature enablerand_core/getrandominstead ofrand_core/std(#745)
- Argument ordering to
BoxedUint::chain(#315) - Modulus leading zeros calculation for
MontyForm/BoxedMontyForm(#713)
ct_*prefixes from method names since we're constant-time by default (#417)const_assert_*macros (#452, #690)
trailing_ones[_vartime](),trailing_zeros_vartime(),leading_zeros_vartime()(#282)- Implement
ArrayEncodingforU832(#288)
- Make
Uint::random_mod()work identically on 32- and 64-bit targets (#285)
BoxedUint: heap-allocated fixed-precision integers (#221)extra-sizesfeature (#229)U4224andU4352(#233)- Zeroizing support for
DynResidue(#235) cmp_vartime,ct_cmp(#238)- Expose Montgomery form in
Residue/DynResidue(#239) - Make
Uint::powwork with different sized exponents (#251) - Expose
wrapping_neg(#252) - Make
concat,split, and multiply work with different sized operands (#253) U16384andU32768(#255)Uint::{inv_mod, inv_mod2k_vartime}(#263)const fnconstructors forNonZero<Uint>andNonZero<Limb>(#266)- Constant-time
Uint::shr()andUint::shl()(#267) - Subtle trait impls for
DynResidueandDynResidueParams(#269)
- Modular inversion improvements (#263)
serdectusage (#222)- Enforce valid modulus for
DynResidueParams(#240) - Enforce valid modulus for
Residueand associated macros (#243) - Make
Uint::{from_be_hex, from_le_hex}constant-time (#254) - Remove conditionals in
Uint::saturating_add()andsaturating_mul()(#256) - More logical checks in the
Uint::random_mod()test (#256) - Mark
sqrtfor renaming, to explicitly describe it as vartime (#256)
- Expose residue params and modulus in
DynResidue(#197) - Impl
DefaultIsZeroesforResidue(#210) div_by_2()method for integers in Montgomery form (#211, #212)
- Montgomery multiplication improvements (#203)
- Improve
Debugimpls onLimbandUint(#195)
const_residuemacro accessibility bug (#193)
Residue: modular arithmetic with static compile-time moduli (#130)DynResidue: modular arithmetic with dynamic runtime moduli (#134)- Constant-time division by a single
Limb(#141) - Windowed exponentiation for
(Dyn)Residue(#147) SubResiduetrait and impls forResidueandDynResidue(#149)Pow,InvertandSquare(#155)CtChoicetype (#159)BITS,BYTES, andLIMBStoIntegertrait (#161)- Impl
RandomforWrapping(#168) - Support to concat
U320andU640(#173) - Define
U224andU544on 32-bit platforms (#179, #180)
- Rename
UInt->Uint(#143) - Rename
Uintmethods (#144)limbs->as_limbslimbs_mut->as_limbs_mutinto_limbs->to_limbs
- Faster
random_mod(#146) - Constant-time
leading_zeros(),trailing_zeros(),bits(), andbit()forUint(#153) - Rename
BIT_SIZE->BITS,BYTE_SIZE->BYTES(#157) - More efficient squaring operation ([#133])
- Use
CryptoRngCore(#164) - Bump
serdectto 0.2 (#185) - Bump
derdependency to v0.7; MSRV 1.65 (#187)
UInt::from_wordand::from_wide_word(#105)UIntmodulo operations for special moduli (#108)- Non-const
UIntdecoding from an array (#110) const fnimpls ofconcatandsplit(#111)Limbleft/right bitshifts (#112)UInt::LIMBSconstant (#114)
- Optimize
UInt::neg_modby simply calling::sub_mod(#106) - Relax bounds for
UInt::add_modand::sub_mod(#104) - Always inline
Limb::bitand(#109) - Faster const decoding of UInt (#113)
- Optimize
UInt::neg_mod(#127) - Faster comparisons (#128)
UInt::resize(#129)UInt::bitaccessor methods (#122)
- Constant-time behaviour for
ct_reduce/ct_div_rem(#117)
Wordas a replacement forLimbUInt(#88)WideWordas a replacement forWideLimbUInt(#88)UInt::*_wordsas a replacement forUInt::*_uint_array(#88)
- Deprecated
*LimbUIntandUInt::*_uint_array(#88)
Encodingtests (#93)
- Use const generic impls of
*Modtraits (#98)
- Impl
ArrayEncodingforU576(#96)
UInt::as_uint_array(#91)
- Impl
AsRef/AsMut<[LimbUInt]>forUInt(#89)
UInt::inv_mod2k(#86)
- Wrong results for remainder (#84)
- Bug in
from_le_slice(#82)
NOTE: this release was yanked due to #82.
- Pad limbs with zeros when displaying hexadecimal representation (#74)
Output = Selfto all bitwise ops onIntegertrait (#53)
- Bitwise ops to
Integertrait (#51)
- Bitwise
Xor/Notoperations (#27) Zerotrait (#35)Checked*traits (#41)preludemodule (#45)saturating_*ops (#47)
- Rust 2021 edition upgrade; MSRV 1.56 (#33)
- Reverse ordering of
UInt::mul_widereturn tuple (#34) - Have
DivandRemimpls always takeNonZeroargs (#39) - Rename
limb::InnertoLimbUInt(#40) - Make
limbmodule private (#40) - Use
Zero/Integertraits foris_zero,is_odd, andis_even(#46)
- Deprecated
LIMB_BYTESconstant (#43)
UInt::sqrt(#9)
- Make
UIntdivision similar to other interfaces (#8)
- Implement constant-time division and modulo operations
- Moved from RustCrypto/utils to RustCrypto/crypto-bigint repo (#2)
UInt::shl_vartime
add_modoverflow handling
IntegertraitShrAssignimpl forUInt- Recursive Length Prefix (RLP) encoding support for
UInt
ConditionallySelectableimpl forUInt
- Expose
limbmodule [limb::Inner; LIMBS]conversions forUInt- Bitwise right shift support for
UInt([#586], [#590])
UInt::wrapping_mul
- Implement the
Hashtrait forUIntandLimb
Limb::is_oddandUInt::is_oddUInt::newrandfeature
- Deprecate
LIMB_BYTESconstant - Make
Limb'sInnervalue public
Limbnewtype- Target-specific rustdocs
ConstantTimeGreater/ConstantTimeLessimpls for UIntFromconversions betweenUIntand limb arrayszeroizefeature- Additional
ArrayEncoding::ByteSizebounds UInt::into_limbsEncodingtrait
NumBits/NumBytestraits; useEncodinginstead
- Initial release