feat: add OpenSSL backend for checksum utilities#12412
Draft
sylvestre wants to merge 1 commit into
Draft
Conversation
Add an optional OpenSSL (libcrypto) backend for md5/sha1/sha2-family digest computations. OpenSSL provides hand-tuned assembly implementations (AVX2, SSSE3, etc.) that are substantially faster than the pure-Rust crates on CPUs without SHA-NI hardware instructions. Benchmarks on Intel i9-7940X (no SHA-NI), 100MB file: sha256sum: 470ms -> 234ms (was 1.9x slower than GNU, now ~1.0x) sha1sum: 198ms -> 131ms (was 1.6x slower, now ~1.09x) sha512sum: 246ms -> 166ms (was 1.4x slower, now ~0.96x - faster!) md5sum: 185ms -> 174ms (was 1.2x slower, now ~1.09x) Closes uutils#12251
Contributor
|
|
|
GNU testsuite comparison: |
xtqqczze
reviewed
May 21, 2026
| xattr = { workspace = true, optional = true } | ||
| # OpenSSL is only used on Unix targets. On Windows, enabling the `openssl` | ||
| # feature is a no-op and the pure-Rust digest implementations are used. | ||
| openssl = { workspace = true, optional = true } |
xtqqczze
reviewed
May 21, 2026
| # Use OpenSSL (libcrypto) for md5/sha1/sha2-family digests instead of the | ||
| # pure-Rust crates. This dramatically speeds up checksum utilities on CPUs | ||
| # without SHA-NI by using OpenSSL's optimized assembly implementations. | ||
| openssl = ["dep:openssl"] |
Contributor
|
maybe add |
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.
Add an optional OpenSSL (libcrypto) backend for md5/sha1/sha2-family digest computations. OpenSSL provides hand-tuned assembly implementations (AVX2, SSSE3, etc.) that are substantially faster than the pure-Rust crates on CPUs without SHA-NI hardware instructions.
Benchmarks on Intel i9-7940X (no SHA-NI), 100MB file:
sha256sum: 470ms -> 234ms (was 1.9x slower than GNU, now ~1.0x)
sha1sum: 198ms -> 131ms (was 1.6x slower, now ~1.09x)
sha512sum: 246ms -> 166ms (was 1.4x slower, now ~0.96x - faster!)
md5sum: 185ms -> 174ms (was 1.2x slower, now ~1.09x)
Closes #12251