Skip to content

S324 false negative on mixed-case hash algorithm names #16525

@dscorbett

Description

@dscorbett

Summary

hashlib.new interprets the algorithm name case-insensitively. hashlib-insecure-hash-function (S324) recognizes lowercase and uppercase names, but not mixed-case names.

$ cat >s324.py <<'# EOF'
import hashlib
print(hashlib.new("Md5").hexdigest())
# EOF

$ python s324.py
d41d8cd98f00b204e9800998ecf8427e

$ ruff check --isolated --select S324 s324.py
All checks passed!

Version

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedContributions especially welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions