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
Use traits implemented for all Uint/Int types (#1008)
Closes#793
- `Split` and `Concat` reworked to be implementable for all `Uint`s
generically.
- `SplitMixed` and `ConcatMixed` removed (`Split` and `Concat` implement
their functionality).
- `RemMixed` removed - `Rem` already allows custom rhs sizes. Moreover,
the name `RemMixed`/`rem_mixed()` was misleading because it actually
used variable time division inside.
- `Encoding` implemented for all `Uint`s. `Encoding::Repr` for `Uint` is
now an `EncodedUint` struct instead of an array.
- Macros deriving `Encoded`, `SplitMixed`, `ConcatMixed`, and `RemMixed`
are removed.
- Relaxed the bound on the error of `Encoding::Repr as TryFrom<&[u8]>`
from a concrete type to a `core::error::Error` trait.
Notes:
- The new split/concat errors for incorrect sizes, while being compile
time, may not be entirely informative. First, I can't format the error
string in the `panic!()` (without another dependency), second, the
compiler often does not say which monomorphization caused the error.
- `Uint::to_le/be_bytes()` are quite similar to
`Uint::write_le/be_bytes()`, the former being `const fn`, the latter
being faster (since they can operate with `Word`-sized chunks instead of
single bytes).
- the `extra_sizes` feature may be removed since now it only defines
`Uint` aliases and doesn't impl any traits.
- We use `serdect` for constant-time serialization, so we are concerned
about serializing secrets... But `Encoding` methods litter the stack
with the serialized data (not introduced in this PR, it was the same
before). Is that a concern as well?
0 commit comments