Skip to content

Add IncrementalHash.GetCurrentHash#37936

Merged
bartonjs merged 4 commits into
dotnet:masterfrom
bartonjs:getcurrenthash
Jun 23, 2020
Merged

Add IncrementalHash.GetCurrentHash#37936
bartonjs merged 4 commits into
dotnet:masterfrom
bartonjs:getcurrenthash

Conversation

@bartonjs

Copy link
Copy Markdown
Member

This adds

  • int IncrementalHash::GetHashAndReset(Span<byte>)
  • byte[] IncrementalHash::GetCurrentHash()
  • int IncrementalHash::GetCurrentHash(Span<byte>)
  • bool IncrementalHash::TryGetCurrentHash(Span<byte>, out int)

While simplifying the internal logic (all three variants of GetHashAndReset collapse to the PAL int GetHashAndReset(Span<byte>), and similarly for all three variants of GetCurrentHash).

This change also drives the code coverage for the IncrementalHash class up to 100%.

Fixes #1968.

@bartonjs bartonjs added this to the 5.0.0 milestone Jun 15, 2020
@bartonjs bartonjs self-assigned this Jun 15, 2020
@ghost

ghost commented Jun 15, 2020

Copy link
Copy Markdown

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq
Notify danmosemsft if you want to be subscribed.

@Dotnet-GitSync-Bot

Copy link
Copy Markdown
Collaborator

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, to 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.

Comment thread src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.c Outdated
@vcsjones

Copy link
Copy Markdown
Member

Same link

The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are obsolete but are retained to maintain compatibility with existing code.

@bartonjs

Copy link
Copy Markdown
Member Author

Bah, should've linked to the 1.1.0 version 😁

Comment thread src/libraries/Common/src/Internal/Cryptography/HashProviderCng.cs
Comment thread src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.h Outdated
Comment thread src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h Outdated
@bartonjs
bartonjs merged commit 10abe8d into dotnet:master Jun 23, 2020
@bartonjs
bartonjs deleted the getcurrenthash branch June 23, 2020 17:28
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
@bartonjs bartonjs removed their assignment Jul 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incremental Hash, allowing to continue to hash

5 participants