Repository navigation
Add string.GetHashCodeWeak - #137828
Open
Manish-1kumar wants to merge 3 commits into
Open
Add string.GetHashCodeWeak#137828Manish-1kumar wants to merge 3 commits into
Manish-1kumar wants to merge 3 commits into
Conversation
Per API review, XOR the hash code with a per-process random seed so that it isn't mistaken for a stable hash. The seed is separate from the Marvin seed and is generated on first use. Update the docs to describe the weak, process-specific nature of the hash, and restore the BOM in String.Comparison.cs. Cover GetHashCodeWeak in the cross-process test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-runtime |
This was referenced Nov 18, 2026
Pass the per-process seed into shared span helpers that GetNonRandomizedHashCode and GetNonRandomizedHashCodeOrdinalIgnoreCase also use with their existing constant seed, and drop the unnecessary Debug.Fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 20, 2026
This branch has not been 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.
Implements the API approved in #77679:
Behavior
Ordinaluses the existing non-randomized ordinal hash, andOrdinalIgnoreCaseuses the existing non-randomized ordinal-ignore-case hash. These are the fast hashes used internally byDictionary<string, ...>before it switches to randomized hashing.string.GetHashCode.StringComparisonvalues throwArgumentException(onlyOrdinalandOrdinalIgnoreCasein v1, per the review).Testing
OrdinalIgnoreCase, and unsupported comparison types.GetHashCodeWeak(both overloads) is added to the existing cross-process test, which checks that the hash code for the same string differs between two processes.Fixes #77679
🤖 Generated with Claude Code