Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions Src/CrispyWaffle/Cryptography/HashAlgorithmType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,21 @@ public enum HashAlgorithmType
/// The SHA-512 algorithm.
/// </summary>
Sha512,

#if NET8_0_OR_GREATER
/// <summary>
/// The SHA3-256 algorithm. Available in .NET 8.0 and later.
/// </summary>
Sha3_256,

/// <summary>
/// The SHA3-384 algorithm. Available in .NET 8.0 and later.
/// </summary>
Sha3_384,

/// <summary>
/// The SHA3-512 algorithm. Available in .NET 8.0 and later.
/// </summary>
Sha3_512,
#endif
}
5 changes: 5 additions & 0 deletions Src/CrispyWaffle/Cryptography/Security.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,15 @@
/// </summary>
private static readonly Dictionary<HashAlgorithmType, HashAlgorithm> _hashAlgorithms = new()
{
{ HashAlgorithmType.Md5, MD5.Create() },

Check warning on line 155 in Src/CrispyWaffle/Cryptography/Security.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

_hashAlgorithms uses a broken cryptographic algorithm MD5 (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5351)
{ HashAlgorithmType.Sha1, SHA1.Create() },

Check warning on line 156 in Src/CrispyWaffle/Cryptography/Security.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

_hashAlgorithms uses a weak cryptographic algorithm SHA1 (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5350)
{ HashAlgorithmType.Sha256, SHA256.Create() },
{ HashAlgorithmType.Sha384, SHA384.Create() },
{ HashAlgorithmType.Sha512, SHA512.Create() },
#if NET8_0_OR_GREATER
{ HashAlgorithmType.Sha3_256, SHA3_256.Create() },
{ HashAlgorithmType.Sha3_384, SHA3_384.Create() },
{ HashAlgorithmType.Sha3_512, SHA3_512.Create() },
#endif
};
}
Loading