Skip to content

Conversation

IDisposable
Copy link
Contributor

@IDisposable IDisposable commented Jun 7, 2023

In PR #84132, the addition of SHA3 variants to the HashAlgorithmNames was incomplete, leaving out the explicit handling of the SHA3 variants from the two helper methods:

  • ToUpper() - Would just return the name unchanged (which is likely wrong as it would allow sha3-256 through instead of uppercasing to SHA3-256. That's probably wrong.
  • ToAlgorithmName() - Would return the ToString() on the supplied hashAlgorithm instance, which would be the classname of the argument hashAlgorithm (e.g. "System.Security.Cryptography.SHA3_256"). That would not match the expectation of "SHA3-256" based on the other instances.

I am not sure how important these are, or if they should be wrapped in a #if NET8_0_OR_GREATER wrapper like only some of the new SHA3 stuff was wrapped in that PR.

In PR dotnet#84132, the addition of SHA3 variants to the HashAlgorithmNames was incomplete, leaving out the explicit handling of the SHA3 variants from the two helper methods:
  - `ToUpper()` - Would just return the name **unchanged** (which is likely wrong as it would allow _sha3-256_ through instead of uppercasing to _SHA3-256_. That's probably wrong.
- `ToAlgorithmName()` - Would return the `ToString()` on the supplied `hashAlgorithm` instance, which would be the classname of the argument `hashAlgorithm` (e.g. `"System.Security.Cryptography.SHA3_256"`). That would not match the expectation of `"SHA3-256"` based on the other instances.
I am not sure how important these are, or if they should be wrapped in a `#if NET8_0_OR_GREATER` wrapper (only some of the new SHA3 stuff was wrapped in that PR)
@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-System.Security labels Jun 7, 2023
@ghost
Copy link

ghost commented Jun 7, 2023

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: IDisposable
Assignees: -
Labels:

area-System.Security, community-contribution

Milestone: -

@IDisposable IDisposable changed the title Add missing SHA3 support helpers Add missing SHA3 helpers in HashAlgorithmNames Jun 7, 2023
@IDisposable
Copy link
Contributor Author

Looking for comments from @vcsjones and @steveharter

@IDisposable
Copy link
Contributor Author

IDisposable commented Jun 7, 2023

Also I checked in unit tests for the HashAlgorithmNames before realizing it was an internal struct. I am not sure if there is any precedent for exposing those for testing... but had there been tests before we wouldn't have missed this... sigh

@IDisposable IDisposable marked this pull request as ready for review June 7, 2023 23:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Security community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants