A hash is computed with MD5 or SHA-1, which are broken for security uses
What it finds
MessageDigest.getInstance("MD5") and "SHA-1" are broken: collisions can be made on purpose, so they cannot protect integrity or passwords. SHA-256 or better, and for passwords a slow function such as PBKDF2, bcrypt or Argon2, hold up. Checksums for non-security purposes may be fine, which is why the rule is not in the default tier.
From the rule's source, weak_hash.rs.
import java.security.MessageDigest fun digest(data: ByteArray): ByteArray { val md5 = MessageDigest.getInstance("MD5")tx0 reports: MD5 is a broken hash algorithm val sha1 = MessageDigest.getInstance("SHA-1")tx0 reports: SHA-1 is a broken hash algorithm val sha256 = MessageDigest.getInstance("SHA-256") return sha256.digest(data)} 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:
[rules]
"tx0/kotlin:broken-digest-algorithm" = "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/kotlin:broken-digest-algorithm] reason="..."tx0 explain tx0/kotlin:broken-digest-algorithm shows the same in the terminal. Found a false positive? Report it.