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.
TryFrom<&[u8]>
bound onEncoding::Repr
(#261)- New
Uint
functionality: - New
BoxedUint
functionality:- 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-traits
impls: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
Zeroize
forNonZero
wrapper (#406) Zero::set_zero
method (#426)Inverter
/PrecomputeInverter
traits (#438, #444)- Uint:
const fn
encoders (#453) - Traits to connect integers and Montgomery form representations (#431):
Integer::Monty
associated typeMonty
trait with arithmetic bounds and an associatedMonty::Integer
type
Odd
wrapper type (#487)NonZero::new_unwrap
(#602)- Implement Karatsuba multiplication for
Uint
andBoxedUint
(#649) - Efficient linear combination for Montgomery forms (#666)
- Doc comment support for
impl_modulus!
(#676) core::error::Error
support (#680)Int
type providing initial signed integer support using two's complement (#695, #730)- Variable-time modular inversion support (#731)
- Toplevel
modular
module now contains all modular functionality (#300, #324) Integer
trait: expand bounds to include*Mod
(#318),Add
/Sub
/Mul
(#435),RemAssign
(#709),AddAssign
/MulAssign
/SubAssign
(#716)Integer
trait: add new methodsbits(_vartime)
/leading_zeros
(#368),from_limb_like/
one_like/
zero_like` (#533)- Replace
BoxedUint::new
with::zero_with_precision
(#327) - Split
Zero
trait intoZero
+ZeroConstant
(#335) - Refactor
Integer
trait; addConstants
/LimbsConstant
(#355)- The existing
Bounded
trait subsumesBITS
/BYTES
Constants
providesONE
andMAX
LimbsConstant
providesLIMBS
- The existing
- Rename
BoxedUint::mul_wide
tomul
(#359) - Round up
bits_precision
when creatingBoxedUint
(#365) - Make bit ops use
u32
for shifts and bit counts (#373) - Align with
core
/std
on overflow behavior for bit shifts (#395) - Make
inv_mod2k(_vartime)
return aCtChoice
(#416) - Rename
CtChoice
toConstChoice
(#417) - Make division methods take
NonZero
-wrapped divisors (#419) - Align with
core
/std
onoverflowing_sh*
for functions which return an overflow flag (#430) Uint
: renameHLIMBS
toRHS_LIMBS
(#432)- Bring
Checked*
traits in line withWrapping*
(#434) - Rename
*Residue*
types i.e. Montgomery form representations (#485):Residue
->ConstMontyForm
DynResidue
->MontyForm
BoxedResidue
->BoxedMontyForm
*ResidueParams
->*MontyParams
residue_params
->params
params.r
->params.one
- Make
Monty::new_params()
take anOdd
-wrapped modulus (#488) - Expand
Uint
support forconst fn
:square
(#514),widening_mul
(#515),to_le_bytes
(#555) - Have
(Boxed)MontyParams::modulus
return&Odd<_>
(#517) - Split
MontyParams::new
andnew_vartime
([#516], #518) - Reverse
Concat(Mixed)
/Split(Mixed)
argument ordering (#526) - Migrate from
generic-array
tohybrid-array
(#544) - Replace
ZeroConstant
withConstZero
trait fromnum-traits
(#546, #573) - Change
Uint::concat_mixed
andsplit_mixed
to acceptself
; makepub
(#556, #558) - Make
Uint::concat
andsplit
const generic over inputs (#557, #558) - Split
Uint::mul_mod
andUint::mul_mod_vartime
(#623) - Faster constant-time division (#643)
BoxedMontyForm
: always useArc
forparams
(#645)- Leverage
const_mut_refs
; MSRV 1.83 (#667) - Bump
rlp
dependency from 0.5 to 0.6 (#673) - Require
RngCore
instead ofCryptoRngCore
for various random methods (#710) - Bump
serdect
dependency to v0.3 (#719) - Have
rand
feature enablerand_core/getrandom
instead 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
ArrayEncoding
forU832
(#288)
- Make
Uint::random_mod()
work identically on 32- and 64-bit targets (#285)
BoxedUint
: heap-allocated fixed-precision integers (#221)extra-sizes
feature (#229)U4224
andU4352
(#233)- Zeroizing support for
DynResidue
(#235) cmp_vartime
,ct_cmp
(#238)- Expose Montgomery form in
Residue
/DynResidue
(#239) - Make
Uint::pow
work with different sized exponents (#251) - Expose
wrapping_neg
(#252) - Make
concat
,split
, and multiply work with different sized operands (#253) U16384
andU32768
(#255)Uint::{inv_mod, inv_mod2k_vartime}
(#263)const fn
constructors forNonZero<Uint>
andNonZero<Limb>
(#266)- Constant-time
Uint::shr()
andUint::shl()
(#267) - Subtle trait impls for
DynResidue
andDynResidueParams
(#269)
- Modular inversion improvements (#263)
serdect
usage (#222)- Enforce valid modulus for
DynResidueParams
(#240) - Enforce valid modulus for
Residue
and 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
sqrt
for renaming, to explicitly describe it as vartime (#256)
- Expose residue params and modulus in
DynResidue
(#197) - Impl
DefaultIsZeroes
forResidue
(#210) div_by_2()
method for integers in Montgomery form (#211, #212)
- Montgomery multiplication improvements (#203)
- Improve
Debug
impls onLimb
andUint
(#195)
const_residue
macro 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) SubResidue
trait and impls forResidue
andDynResidue
(#149)Pow
,Invert
andSquare
(#155)CtChoice
type (#159)BITS
,BYTES
, andLIMBS
toInteger
trait (#161)- Impl
Random
forWrapping
(#168) - Support to concat
U320
andU640
(#173) - Define
U224
andU544
on 32-bit platforms (#179, #180)
- Rename
UInt
->Uint
(#143) - Rename
Uint
methods (#144)limbs
->as_limbs
limbs_mut
->as_limbs_mut
into_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
serdect
to 0.2 (#185) - Bump
der
dependency to v0.7; MSRV 1.65 (#187)
UInt::from_word
and::from_wide_word
(#105)UInt
modulo operations for special moduli (#108)- Non-const
UInt
decoding from an array (#110) const fn
impls ofconcat
andsplit
(#111)Limb
left/right bitshifts (#112)UInt::LIMBS
constant (#114)
- Optimize
UInt::neg_mod
by simply calling::sub_mod
(#106) - Relax bounds for
UInt::add_mod
and::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::bit
accessor methods (#122)
- Constant-time behaviour for
ct_reduce
/ct_div_rem
(#117)
Word
as a replacement forLimbUInt
(#88)WideWord
as a replacement forWideLimbUInt
(#88)UInt::*_words
as a replacement forUInt::*_uint_array
(#88)
- Deprecated
*LimbUInt
andUInt::*_uint_array
(#88)
Encoding
tests (#93)
- Use const generic impls of
*Mod
traits (#98)
- Impl
ArrayEncoding
forU576
(#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 = Self
to all bitwise ops onInteger
trait (#53)
- Bitwise ops to
Integer
trait (#51)
- Bitwise
Xor
/Not
operations (#27) Zero
trait (#35)Checked*
traits (#41)prelude
module (#45)saturating_*
ops (#47)
- Rust 2021 edition upgrade; MSRV 1.56 (#33)
- Reverse ordering of
UInt::mul_wide
return tuple (#34) - Have
Div
andRem
impls always takeNonZero
args (#39) - Rename
limb::Inner
toLimbUInt
(#40) - Make
limb
module private (#40) - Use
Zero
/Integer
traits foris_zero
,is_odd
, andis_even
(#46)
- Deprecated
LIMB_BYTES
constant (#43)
UInt::sqrt
(#9)
- Make
UInt
division 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_mod
overflow handling
Integer
traitShrAssign
impl forUInt
- Recursive Length Prefix (RLP) encoding support for
UInt
ConditionallySelectable
impl forUInt
- Expose
limb
module [limb::Inner; LIMBS]
conversions forUInt
- Bitwise right shift support for
UInt
([#586], [#590])
UInt::wrapping_mul
- Implement the
Hash
trait forUInt
andLimb
Limb::is_odd
andUInt::is_odd
UInt::new
rand
feature
- Deprecate
LIMB_BYTES
constant - Make
Limb
'sInner
value public
Limb
newtype- Target-specific rustdocs
ConstantTimeGreater
/ConstantTimeLess
impls for UIntFrom
conversions betweenUInt
and limb arrayszeroize
feature- Additional
ArrayEncoding::ByteSize
bounds UInt::into_limbs
Encoding
trait
NumBits
/NumBytes
traits; useEncoding
instead
- Initial release