Skip to content

Upgrade sha2 to enable ARM hardware acceleration by default - #20831

Merged
zanieb merged 1 commit into
mainfrom
zb/upgrade-sha2-arm-hardware
Jul 30, 2026
Merged

zanieb merged 1 commit into
mainfrom
zb/upgrade-sha2-arm-hardware

Conversation

@astral-automations-bot

@astral-automations-bot astral-automations-bot Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

sha2 0.10 only enables ARM SHA-256 acceleration through its optional asm feature, requiring the sha2-asm dependency and platform-specific configuration added in #20805.

Upgrade to sha2 0.11, which selects its ARM backend automatically when CPU feature detection is available. This preserves accelerated distribution hashing on Apple Silicon and Linux/Android ARM while removing sha2-asm and its target-specific configuration. Windows on ARM still falls back to software because cpufeatures does not yet support feature detection there (RustCrypto/utils#1124).

The upgrade also moves SHA-2 to digest 0.11. Two follow-ups complete the migration for the other supported hash algorithms: #20833 upgrades md-5 to its stable 0.11 release, and #20834 upgrades blake2 to 0.11.0-rc.6, its first release compatible with digest 0.11.

@zanieb
zanieb force-pushed the zb/upgrade-sha2-arm-hardware branch from 00d1a1b to c6dcbaf Compare July 30, 2026 19:34
@codspeed

codspeed Bot commented Jul 30, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 6.94%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
✅ 20 untouched benchmarks
⏩ 6 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime hash_sha256 1.3 ms 1.2 ms +9.94%
⚡ Simulation hash_sha256 17.9 ms 16.9 ms +5.85%
⚡ Simulation prepare_wheel_many_files 110.2 ms 104.8 ms +5.08%

Tip

Curious why this is faster? Use the CodSpeed MCP and ask your agent.


Comparing zb/upgrade-sha2-arm-hardware (c6dcbaf) with main (7d9e4aa)2

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (586d850) during the generation of this report, so 7d9e4aa was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@zanieb
zanieb merged commit 998491f into main Jul 30, 2026
117 checks passed
@zanieb
zanieb deleted the zb/upgrade-sha2-arm-hardware branch July 30, 2026 20:17
zanieb added a commit that referenced this pull request Jul 30, 2026
#20831 moves SHA-2 to `digest` 0.11, while `md-5` still
depends on `digest` 0.10. That leaves the distribution hashing path
using incompatible digest traits.

Upgrade `md-5` to its stable 0.11 release so MD5 and SHA-2 share the
same digest API without changing supported hashes or `--require-hashes`
behavior. BLAKE2 remains on the older digest trait in this change;
#20834 completes its migration separately.

Co-authored-by: Zanie Blue <contact@zanie.dev>
zanieb added a commit that referenced this pull request Jul 30, 2026
#20831 and #20833 move SHA-2 and MD5 to `digest`
0.11, but the latest stable `blake2` release still depends on `digest`
0.10. This leaves the distribution hashing path with an unnecessary
compatibility import for the older digest trait.

Upgrade `blake2` to `0.11.0-rc.6` so MD5, SHA-2, and BLAKE2 share the
same digest API. Preserve the existing 256-bit BLAKE2b output for
local-wheel hash verification.

This intentionally adopts a prerelease because no stable BLAKE2 release
is compatible with `digest` 0.11 yet.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>

This branch was previously deployed

1 inactive deployment
automations — c6dcbaf2 Deployed Jul 30, 2026 by zanieb via review / security review #43838
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.

2 participants