Skip to content

Commit d2598d4

Browse files
committed
Crypto: Updating weak hash tests
1 parent 4860034 commit d2598d4

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
#select
21
| WeakHashing.java:15:55:15:83 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
32
| WeakHashing.java:18:56:18:95 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
43
| WeakHashing.java:21:86:21:90 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
54
| WeakHashing.java:24:56:24:62 | HashAlgorithm | Use of unapproved hash algorithm or API: SHA1. |
6-
| WeakHashing.java:34:56:34:96 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
7-
testFailures
8-
| WeakHashing.java:27:125:27:133 | // $Alert | Missing result: Alert |
9-
| WeakHashing.java:40:111:40:119 | // $Alert | Missing result: Alert |

java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownHash/WeakHashing.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ void hashing() throws NoSuchAlgorithmException, IOException {
3030

3131
props2.load(new FileInputStream("unobserved-file.properties"));
3232

33-
// BAD: "hashalg1" is not visible in the file loaded for props2
34-
MessageDigest bad6 = MessageDigest.getInstance(props2.getProperty("hashAlg1", "SHA-256")); // $Alert[java/quantum/weak-hash]
33+
// BAD: "hashAlg2" is not visible in the file loaded for props2, should be an unknown
34+
// FALSE NEGATIVE for unknown hash
35+
MessageDigest bad6 = MessageDigest.getInstance(props2.getProperty("hashAlg2", "SHA-256")); // $Alert[java/quantum/unknown-hash]
3536

3637
// GOOD: Using a strong hashing algorithm
3738
MessageDigest ok = MessageDigest.getInstance(props.getProperty("hashAlg2"));

0 commit comments

Comments
 (0)