mirror of
https://github.com/github/codeql.git
synced 2026-04-22 15:25:18 +02:00
Add more test cases
This commit is contained in:
@@ -14,7 +14,16 @@ public class WeakHashing {
|
||||
// BAD: Using a weak hashing algorithm
|
||||
MessageDigest bad = MessageDigest.getInstance(props.getProperty("hashAlg1"));
|
||||
|
||||
// BAD: Using a weak hashing algorithm even with a secure default
|
||||
MessageDigest bad2 = MessageDigest.getInstance(props.getProperty("hashAlg1", "SHA-256"));
|
||||
|
||||
// GOOD: Using a strong hashing algorithm
|
||||
MessageDigest ok = MessageDigest.getInstance(props.getProperty("hashAlg2"));
|
||||
|
||||
// OK: Using a strong hashing algorithm even with a weak default
|
||||
MessageDigest ok2 = MessageDigest.getInstance(props.getProperty("hashAlg2", "MD5"));
|
||||
|
||||
// OK: Property does not exist and default is secure
|
||||
MessageDigest ok3 = MessageDigest.getInstance(props.getProperty("hashAlg3", "SHA-256"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user