Skip to content

sha2: add soft-compact backend #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 30, 2025
Merged

sha2: add soft-compact backend #686

merged 3 commits into from
Apr 30, 2025

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Apr 28, 2025

The new backend results in a much smaller binary code (e.g. for SHA-256 on thumbv7em-none-eabi we 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 with opt-level=s it results in 289 MB/s vs 315 MB/s).

We probably should also backport this PR to the backports/digest-v0.10 branch and release sha2 v0.10.9 with this addition.

Closes #561

@newpavlov newpavlov requested a review from tarcieri April 28, 2025 15:37
newpavlov added a commit that referenced this pull request Apr 30, 2025
This PR is a slightly modified backport of [#686]. Instead of the
configuration flag it introduces the `force-soft-compact` crate feature.

[#686]: #686
@newpavlov newpavlov merged commit 9b497dd into master Apr 30, 2025
29 checks passed
@newpavlov newpavlov deleted the sha2/soft-compact branch April 30, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

soft-sha512 code size seems unreasonably high on thumbv7em
2 participants