A broken hash algorithm, MD5 or SHA-1, is used

tx0/csharp:weak-hashrecommendedwarningsecurity/cryptodepth fastsecurity, cwe-328

What it finds

Collisions for MD5 and SHA-1 can be computed, so they no longer protect the integrity of data, signatures or stored passwords. SHA-256 or stronger hashes do. Uses for checksums that need no security, such as cache keys, can be suppressed with a reason.

From the rule's source, weak_hash.rs.

Example from the rule's tests
using System.Security.Cryptography; class Hashes{    byte[] Digest(byte[] data)    {        using var md5 = MD5.Create();tx0 reports: MD5 is a broken hash algorithm        var sha1 = new SHA1CryptoServiceProvider();tx0 reports: SHA1CryptoServiceProvider is a broken hash algorithm        using var sha256 = SHA256.Create();        return sha256.ComputeHash(data);    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:weak-hash" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:weak-hash] reason="..."

tx0 explain tx0/csharp:weak-hash shows the same in the terminal. Found a false positive? Report it.