Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uint
values (see serdect: safer bytes handling RustCrypto/formats#1112, it is currently merged but will take some time to propagate); also Bincode is already used byentropy-core
.Signed
values before serializing. They are bounded, and the bound is often much smaller than the full size of the integer, so we now serialize only the actual significant bytes.Signed::random_bounded_bits_scaled()
could produce numbers with a slightly different bound (because thescale
is the RSA modulus, which can be eitherPRIME_BITS * 2
orPRIME_BITS * 2 - 1
in size, depending on the value of the RSA primes). This PR changes it to always produce a number with a fixed bound.For reference, the message sizes after this PR are:
The reduction is 1.5x-2x compared to the base of the PR (mainly due to replacing MessagePack with Bincode; the packing is much less impactful since most of the size is taken by unbounded integers).