[cryptography] upgrade sha2 to 0.11#4018
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
commonware-mcp | 3141574 | Jun 12 2026, 04:59 PM |
Deploying monorepo with
|
| Latest commit: |
3141574
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7e67a203.monorepo-eu0.pages.dev |
| Branch Preview URL: | https://roberto-aarch64-hw-sha256.monorepo-eu0.pages.dev |
Benchmark resultsTip ✅ PASSED: No benchmark exceeded the regression threshold. Benchmark comparison table
Baseline commit(s): |
068d768 to
a111ea2
Compare
a111ea2 to
bf0c219
Compare
6be1047 to
41f109d
Compare
| serde_yaml = "0.9.34" | ||
| sha2 = { version = "0.10.8", default-features = false } | ||
| sha2 = { version = "0.11.0", default-features = false } | ||
| sha2-v010 = { package = "sha2", version = "0.10.9", default-features = false } # temporary: ark generics still require digest 0.10 impls |
There was a problem hiding this comment.
p256 still uses sha2@v0.10, so this wouldn't get removed even if we weren't using ark
| [features] | ||
| default = [ "std" ] | ||
| blake3-parallel = [ "blake3/rayon", "std" ] | ||
| sha2-asm = [ "sha2/asm" ] |
There was a problem hiding this comment.
I think defaulting to hardware accelerated sha256 is a big enough win that this tweak is worth it.
| [features] | ||
| default = [ "std" ] | ||
| blake3-parallel = [ "blake3/rayon", "std" ] | ||
| sha2-asm = [ "sha2/asm" ] |
There was a problem hiding this comment.
Does this mean we can't activate asm for ark?
There was a problem hiding this comment.
Good catch — sha2 0.11 removed the asm feature entirely (hardware acceleration is on by default now), which left no way to enable the asm backend for the 0.10 copy. Restored it as sha2-asm = ["sha2-v010/asm"] in 335fba8, so the ark path (and p256's internal sha2 0.10, via feature unification) can still get hw SHA on aarch64. Goes away once ark moves to digest 0.11.
335fba8 to
b515f53
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
b515f53 to
3141574
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4018 +/- ##
==========================================
- Coverage 95.19% 95.19% -0.01%
==========================================
Files 530 531 +1
Lines 217970 217973 +3
Branches 5277 5277
==========================================
- Hits 207507 207501 -6
- Misses 8683 8693 +10
+ Partials 1780 1779 -1
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Upgrades
sha2to 0.11.0, which removed theasmfeature and selects hardware backends automatically: SHA-NI on x86_64 (as before) and ARMv8 SHA2 intrinsics on aarch64 with runtime detection (previously the portable software implementation by default).Per-target effect:
One wrinkle:
curve25519-dalek's generic APIs (Scalar::from_hashin ed25519 core) and arkworks'DefaultFieldHasher(bandersnatch eVRF) require digest 0.10 trait impls, so those four call sites use a temporary second pinsha2-v010(commented in the workspace manifest) until curve25519-dalek 5 stabilizes (currently 5.0.0-rc.0) and arkworks moves to digest 0.11. Thesha2-asmfeature hook is removed (it would no longer compile against 0.11; nothing enabled it).Cargo.lockshrinks:sha2-asmand itsccbuild dependency leave the graph.Hash outputs are identical, so wire/storage formats and conformance fixtures are unaffected.
Criterion results on Apple M-series vs the previous default (soft) backend:
Verified: 498 cryptography tests (incl. sha256 conformance), 548 runtime tests, 2566 storage tests, wasm32-unknown-unknown cdylib builds for cryptography and storage.
🤖 Generated with Claude Code