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 missing SHA3 helpers in HashAlgorithmNames #87237

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ internal static partial class HashAlgorithmNames
public const string SHA256 = "SHA256";
public const string SHA384 = "SHA384";
public const string SHA512 = "SHA512";

public const string SHA3_256 = "SHA3-256";
public const string SHA3_384 = "SHA3-384";
public const string SHA3_512 = "SHA3-512";
Expand All @@ -31,6 +30,12 @@ internal static partial class HashAlgorithmNames
return HashAlgorithmNames.SHA384;
if (hashAlgorithm is SHA512)
return HashAlgorithmNames.SHA512;
if (hashAlgorithm is SHA3_256)
return HashAlgorithmNames.SHA3_256;
if (hashAlgorithm is SHA3_384)
return HashAlgorithmNames.SHA3_384;
if (hashAlgorithm is SHA3_512)
return HashAlgorithmNames.SHA3_512;
if (hashAlgorithm is MD5)
return HashAlgorithmNames.MD5;

Expand Down Expand Up @@ -63,6 +68,21 @@ public static string ToUpper(string hashAlgorithmName)
return SHA1;
}

if (hashAlgorithmName.Equals(SHA3_256, StringComparison.OrdinalIgnoreCase))
IDisposable marked this conversation as resolved.
Show resolved Hide resolved
{
return SHA3_256;
}

if (hashAlgorithmName.Equals(SHA3_384, StringComparison.OrdinalIgnoreCase))
{
return SHA3_384;
}

if (hashAlgorithmName.Equals(SHA3_512, StringComparison.OrdinalIgnoreCase))
{
return SHA3_512;
}

if (hashAlgorithmName.Equals(MD5, StringComparison.OrdinalIgnoreCase))
{
return MD5;
Expand Down