sha2: add soft-compact backend#686
Merged
Merged
Conversation
newpavlov
force-pushed
the
sha2/soft-compact
branch
from
April 28, 2025 15:32
37b5217 to
4769ab6
Compare
newpavlov
commented
Apr 29, 2025
tarcieri
approved these changes
Apr 29, 2025
newpavlov
added a commit
that referenced
this pull request
Apr 30, 2025
flaub
pushed a commit
to risc0/RustCrypto-hashes
that referenced
this pull request
Jul 24, 2025
…to#687) This PR is a slightly modified backport of [RustCrypto#686]. Instead of the configuration flag it introduces the `force-soft-compact` crate feature. [RustCrypto#686]: RustCrypto#686
1 task
Merged
newpavlov
added a commit
that referenced
this pull request
Mar 25, 2026
### Changed - Edition changed to 2024 and MSRV bumped to 1.85 ([#652]) - Relax MSRV policy and allow MSRV bumps in patch releases - Update to `digest` v0.11 - Replace type aliases with newtypes ([#678]) - `compress256` and `compress512` are moved to the `block_api` module ([#678]) - Implementation of the `SerializableState` trait ([#716]) - Configuration flags for backend selection ([#614], [#615], [#686], [#802]) ### Added - `alloc` crate feature ([#678]) - RISC-V scalar crypto extension support ([#614]) ### Removed - `asm`, `asm-aarch64`, `loongarch64_asm`, and `compress` crate features ([#542]) - `soft` crate feature ([#615]) - `force-soft-compact` crate feature ([#686]) - `std` crate feature ([#678]) [#542]: #542 [#614]: #614 [#615]: #615 [#652]: #652 [#678]: #678 [#686]: #686 [#716]: #716 [#802]: #802
2 tasks
kaidokert
added a commit
to kaidokert/RSA
that referenced
this pull request
Jul 11, 2026
) sha2 0.11 moved the compact backend from the force-soft-compact cargo feature to a rustc cfg (RustCrypto/hashes#686), so the suites have been silently measuring the speed-oriented default since the 0.11 bump. Set sha2_backend_soft="compact" in all three harness configs — the right tradeoff for a size-measurement harness. Measured effect on the verify-minus-baseline .text deltas: - Cortex-M3, SHA-256 configs: ~13.1 -> ~6.5 KiB - RV32, 2048/SHA-256: 21.7 -> 9.5 KiB SHA-1 rows unchanged (sha1 0.11 has no compact soft variant). The README resource table predates this and the 0.4.0 stack; needs a refresh pass from a full suite run.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The new backend results in a much smaller binary code (e.g. for SHA-256 on
thumbv7em-none-eabiwe get ~150 instructions vs ~1680 instructions, for SHA-512 it's ~330 vs ~7950) while being somewhat slower on non-embedded CPUs (e.g. for SHA-256 on my x86-64 laptop withopt-level=sit results in 289 MB/s vs 315 MB/s).We probably should also backport this PR to the
backports/digest-v0.10branch and release sha2 v0.10.9 with this addition.Closes #561