Skip to content

feat: add OpenSSL backend for checksum utilities - #12412

Merged
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:openssl-checksum-backend
Jun 29, 2026
Merged

feat: add OpenSSL backend for checksum utilities#12412
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:openssl-checksum-backend

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

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

@oech3

This comment was marked as outdated.

@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)

@xtqqczze

Copy link
Copy Markdown
Contributor

maybe add BENCHMARKING.md?

@sylvestre
sylvestre marked this pull request as ready for review May 22, 2026 17:12
@sylvestre
sylvestre force-pushed the openssl-checksum-backend branch from 9a1168b to c30707b Compare May 22, 2026 17:42
@oech3

This comment was marked as resolved.

@oech3

This comment was marked as resolved.

sylvestre added 2 commits May 22, 2026 20:12
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
@sylvestre
sylvestre force-pushed the openssl-checksum-backend branch from c30707b to 8cf7de3 Compare May 22, 2026 18:13
Comment thread README.md
`sha384sum`, `sha512sum`, and `cksum`) by using OpenSSL's `libcrypto` instead of
the pure-Rust digest crates, enable the `openssl` feature:
```
cargo build --release --features unix,openssl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thought about make's default? Personally, I think we can just make openssl default if it is vendored.

@oech3

oech3 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Some interesting crates based on openssl fork: https://github.com/aws/aws-lc-rs https://github.com/briansmith/ring

@sylvestre
sylvestre merged commit e34b752 into uutils:main Jun 29, 2026
175 of 176 checks passed
Comment thread README.md
libcrypto instead, set `OPENSSL_NO_VENDOR=1` at build time.

The speedup is largest on CPUs without SHA-NI hardware acceleration. The
feature is a no-op on Windows (the pure-Rust implementations are always used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Checksum utilities, particularly sha1sum and sha256sum, slow compared to GNU coreutils

3 participants