Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NonCryptographicHashAlgorithm Clone methods #113087

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

stephentoub
Copy link
Member

Closes #111908

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR introduces Clone methods to NonCryptographicHashAlgorithm and its implementations so that an algorithm’s internal state can be duplicated.

  • Adds new abstract member Clone in the test driver and updates derived tests.
  • Implements Clone methods in XxHash64, XxHash32, Crc64, Crc32, XxHash128, and XxHash3.
  • Updates reference assemblies to reflect the new Clone API.

Reviewed Changes

File Description
System.IO.Hashing/tests/NonCryptoHashTestDriver.cs Adds abstract Clone member and corresponding test to validate cloning behavior.
System.IO.Hashing/tests/XxHashTests.cs, CrcTests.cs Adds tests ensuring that cloned instances produce identical hash sequences.
System.IO.Hashing/src/System/IO/Hashing/*.cs Implements Clone methods for various hash algorithms.
System.IO.Hashing/ref/System.IO.Hashing.cs Updates public API definitions to include the new Clone methods.

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: Consider adding a Clone() Method to the hash implementations
2 participants