Repository navigation
Avoid validation algorithm allocation in ManagedAuthenticatedEncryptor - #69789
Merged
DeagleGross merged 1 commit intoOct 14, 2026
Merged
DeagleGross merged 1 commit into
DeagleGross merged 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The optimization preserves existing fallback behavior and remains covered by SHA-256 and SHA-512 round-trip paths.
0 open findings
What changed in this PR
Optimizes managed Data Protection by caching HMAC classification and avoiding per-operation algorithm allocations for SHA-256 and SHA-512.
Changes:
- Caches the validation algorithm type during construction.
- Uses static one-shot HMAC APIs for common algorithms.
- Retains the existing factory path for other algorithms.
| File | Description |
|---|---|
ManagedAuthenticatedEncryptor.cs |
Uses cached HMAC classification during encryption and validation. |
HashAlgorithmType.cs |
Defines internal algorithm categories. |
HashAlgorithmExtensions.cs |
Maps keyed hash implementations to those categories. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
BrennanConroy
approved these changes
Oct 13, 2026
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:36 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:36 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:37 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:39 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:40 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:41 — with
GitHub Actions
Inactive
Contributor
|
✅ No documentation PR was created. Confidence that documentation is needed: 3% No docs needed: internal allocation-reduction change with no public or observable behavior change. Documentation surfaces considered
|
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 14, 2026 07:42 — with
GitHub Actions
Inactive
Member
Author
|
/backport to release/11.0 |
Contributor
|
Started backporting to |
2 of 11 tasks
wtgodbe
pushed a commit
that referenced
this pull request
Oct 14, 2026
Co-authored-by: Korolev Dmitry <[email protected]>
This branch was previously deployed
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.
I've looked into #66536, and while I did not figure out if that's the runtime regression (see discussion between Brennan and Kevin in #66536 (comment)), I found we could avoid allocation for SHA256 and SHA512 (most popular covered algorithms).
Local runs on sample:
And
SpanDataProtectorComparisonbenchmarks:Fixes #66536