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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ private module AlgorithmNames {
name = "SHA256" or
name = "SHA384" or
name = "SHA512" or
name = "SHA3"
name = "SHA3" or
name = "SHA3224" or
name = "SHA3256" or
name = "SHA3384" or
name = "SHA3512"
}

predicate isWeakHashingAlgorithm(string name) {
Expand Down
6 changes: 5 additions & 1 deletion python/ql/lib/semmle/python/concepts/CryptoAlgorithms.qll
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ private module AlgorithmNames {
name = "SHA256" or
name = "SHA384" or
name = "SHA512" or
name = "SHA3"
name = "SHA3" or
name = "SHA3224" or
name = "SHA3256" or
name = "SHA3384" or
name = "SHA3512"
}

predicate isWeakHashingAlgorithm(string name) {
Expand Down
10 changes: 10 additions & 0 deletions python/ql/test/library-tests/frameworks/crypto/test_sha3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from Crypto.Hash import SHA3_224

hasher = SHA3_224.new(b"secret message") # $ CryptographicOperation CryptographicOperationInput=b"secret message" CryptographicOperationAlgorithm=SHA3224
print(hasher.hexdigest())


hasher = SHA3_224.new() # $ CryptographicOperation CryptographicOperationAlgorithm=SHA3224
hasher.update(b"secret") # $ CryptographicOperation CryptographicOperationInput=b"secret" CryptographicOperationAlgorithm=SHA3224
hasher.update(b" message") # $ CryptographicOperation CryptographicOperationInput=b" message" CryptographicOperationAlgorithm=SHA3224
print(hasher.hexdigest())
10 changes: 10 additions & 0 deletions python/ql/test/library-tests/frameworks/cryptodome/test_sha3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from Cryptodome.Hash import SHA3_224

hasher = SHA3_224.new(b"secret message") # $ CryptographicOperation CryptographicOperationInput=b"secret message" CryptographicOperationAlgorithm=SHA3224
print(hasher.hexdigest())


hasher = SHA3_224.new() # $ CryptographicOperation CryptographicOperationAlgorithm=SHA3224
hasher.update(b"secret") # $ CryptographicOperation CryptographicOperationInput=b"secret" CryptographicOperationAlgorithm=SHA3224
hasher.update(b" message") # $ CryptographicOperation CryptographicOperationInput=b" message" CryptographicOperationAlgorithm=SHA3224
print(hasher.hexdigest())