You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RustCrypto/utils#563 corrected a bug in wrapping_mul, however it seems the real issue might've been in the return value of mul_wide
Right now the return values are the following:
UInt::mul_wide -> (hi, lo)
Limb::mul_wide -> (lo, hi)
It seems RustCrypto/utils#563 might've been caused by assuming the latter worked like the former. This ordering reflects the little endian internals of this library.
Ideally these would return a UInt which is twice the width using a const impl Concat to prevent this sort of confusion, but since mul_wide is a const fn that isn't currently possible.
Alternatively we could use a struct with lo and hi fields to prevent this confusion.
At the very least, however, the UInt and Limb versions should be consistent.
The text was updated successfully, but these errors were encountered:
Fixes the inconsistency between `UInt::mul_wide` and `Limb::mul_wide` by
reversing the order of the `UInt` version so it returns `(lo, hi)`.
This follows the "little endian" approach used in the rest of this
crate for consistency.
Closes#4
Fixes the inconsistency between `UInt::mul_wide` and `Limb::mul_wide` by
reversing the order of the `UInt` version so it returns `(lo, hi)`.
This follows the "little endian" approach used in the rest of this
crate for consistency.
Closes#4
RustCrypto/utils#563 corrected a bug in
wrapping_mul
, however it seems the real issue might've been in the return value ofmul_wide
Right now the return values are the following:
UInt::mul_wide
->(hi, lo)
Limb::mul_wide
->(lo, hi)
It seems RustCrypto/utils#563 might've been caused by assuming the latter worked like the former. This ordering reflects the little endian internals of this library.
Ideally these would return a
UInt
which is twice the width using aconst impl Concat
to prevent this sort of confusion, but sincemul_wide
is aconst fn
that isn't currently possible.Alternatively we could use a
struct
withlo
andhi
fields to prevent this confusion.At the very least, however, the
UInt
andLimb
versions should be consistent.The text was updated successfully, but these errors were encountered: