---
source: crates/ruff_linter/src/rules/flake8_bandit/mod.rs
---
S324 Probable use of insecure hash functions in `hashlib`: `md5`
 --> S324.py:7:13
  |
6 | # Errors
7 | hashlib.new('md5')
  |             ^^^^^
8 | hashlib.new('md4', b'test')
9 | hashlib.new(name='md5', data=b'test')
  |

S324 Probable use of insecure hash functions in `hashlib`: `md4`
  --> S324.py:8:13
   |
 6 | # Errors
 7 | hashlib.new('md5')
 8 | hashlib.new('md4', b'test')
   |             ^^^^^
 9 | hashlib.new(name='md5', data=b'test')
10 | hashlib.new('MD4', data=b'test')
   |

S324 Probable use of insecure hash functions in `hashlib`: `md5`
  --> S324.py:9:18
   |
 7 | hashlib.new('md5')
 8 | hashlib.new('md4', b'test')
 9 | hashlib.new(name='md5', data=b'test')
   |                  ^^^^^
10 | hashlib.new('MD4', data=b'test')
11 | hashlib.new('sha1')
   |

S324 Probable use of insecure hash functions in `hashlib`: `MD4`
  --> S324.py:10:13
   |
 8 | hashlib.new('md4', b'test')
 9 | hashlib.new(name='md5', data=b'test')
10 | hashlib.new('MD4', data=b'test')
   |             ^^^^^
11 | hashlib.new('sha1')
12 | hashlib.new('sha1', data=b'test')
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha1`
  --> S324.py:11:13
   |
 9 | hashlib.new(name='md5', data=b'test')
10 | hashlib.new('MD4', data=b'test')
11 | hashlib.new('sha1')
   |             ^^^^^^
12 | hashlib.new('sha1', data=b'test')
13 | hashlib.new('sha', data=b'test')
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha1`
  --> S324.py:12:13
   |
10 | hashlib.new('MD4', data=b'test')
11 | hashlib.new('sha1')
12 | hashlib.new('sha1', data=b'test')
   |             ^^^^^^
13 | hashlib.new('sha', data=b'test')
14 | hashlib.new(name='SHA', data=b'test')
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha`
  --> S324.py:13:13
   |
11 | hashlib.new('sha1')
12 | hashlib.new('sha1', data=b'test')
13 | hashlib.new('sha', data=b'test')
   |             ^^^^^
14 | hashlib.new(name='SHA', data=b'test')
15 | hashlib.sha(data=b'test')
   |

S324 Probable use of insecure hash functions in `hashlib`: `SHA`
  --> S324.py:14:18
   |
12 | hashlib.new('sha1', data=b'test')
13 | hashlib.new('sha', data=b'test')
14 | hashlib.new(name='SHA', data=b'test')
   |                  ^^^^^
15 | hashlib.sha(data=b'test')
16 | hashlib.md5()
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha`
  --> S324.py:15:1
   |
13 | hashlib.new('sha', data=b'test')
14 | hashlib.new(name='SHA', data=b'test')
15 | hashlib.sha(data=b'test')
   | ^^^^^^^^^^^
16 | hashlib.md5()
17 | hashlib_new('sha1')
   |

S324 Probable use of insecure hash functions in `hashlib`: `md5`
  --> S324.py:16:1
   |
14 | hashlib.new(name='SHA', data=b'test')
15 | hashlib.sha(data=b'test')
16 | hashlib.md5()
   | ^^^^^^^^^^^
17 | hashlib_new('sha1')
18 | hashlib_sha1('sha1')
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha1`
  --> S324.py:17:13
   |
15 | hashlib.sha(data=b'test')
16 | hashlib.md5()
17 | hashlib_new('sha1')
   |             ^^^^^^
18 | hashlib_sha1('sha1')
19 | # usedforsecurity arg only available in Python 3.9+
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha1`
  --> S324.py:18:1
   |
16 | hashlib.md5()
17 | hashlib_new('sha1')
18 | hashlib_sha1('sha1')
   | ^^^^^^^^^^^^
19 | # usedforsecurity arg only available in Python 3.9+
20 | hashlib.new('sha1', usedforsecurity=True)
   |

S324 Probable use of insecure hash functions in `hashlib`: `sha1`
  --> S324.py:20:13
   |
18 | hashlib_sha1('sha1')
19 | # usedforsecurity arg only available in Python 3.9+
20 | hashlib.new('sha1', usedforsecurity=True)
   |             ^^^^^^
21 |
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT`
  --> S324.py:22:26
   |
20 | hashlib.new('sha1', usedforsecurity=True)
21 |
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
   |                          ^^^^^^^^^^^^^^^^^^
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5`
  --> S324.py:23:26
   |
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
   |                          ^^^^^^^^^^^^^^^^
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
  --> S324.py:24:26
   |
22 | crypt.crypt("test", salt=crypt.METHOD_CRYPT)
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
   |                          ^^^^^^^^^^^^^^^^^^^^^
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
  --> S324.py:25:21
   |
23 | crypt.crypt("test", salt=crypt.METHOD_MD5)
24 | crypt.crypt("test", salt=crypt.METHOD_BLOWFISH)
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
   |                     ^^^^^^^^^^^^^^^^^^^^^
26 |
27 | crypt.mksalt(crypt.METHOD_CRYPT)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_CRYPT`
  --> S324.py:27:14
   |
25 | crypt.crypt("test", crypt.METHOD_BLOWFISH)
26 |
27 | crypt.mksalt(crypt.METHOD_CRYPT)
   |              ^^^^^^^^^^^^^^^^^^
28 | crypt.mksalt(crypt.METHOD_MD5)
29 | crypt.mksalt(crypt.METHOD_BLOWFISH)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_MD5`
  --> S324.py:28:14
   |
27 | crypt.mksalt(crypt.METHOD_CRYPT)
28 | crypt.mksalt(crypt.METHOD_MD5)
   |              ^^^^^^^^^^^^^^^^
29 | crypt.mksalt(crypt.METHOD_BLOWFISH)
   |

S324 Probable use of insecure hash functions in `crypt`: `crypt.METHOD_BLOWFISH`
  --> S324.py:29:14
   |
27 | crypt.mksalt(crypt.METHOD_CRYPT)
28 | crypt.mksalt(crypt.METHOD_MD5)
29 | crypt.mksalt(crypt.METHOD_BLOWFISH)
   |              ^^^^^^^^^^^^^^^^^^^^^
30 |
31 | # OK
   |

S324 Probable use of insecure hash functions in `hashlib`: `Md5`
  --> S324.py:51:13
   |
49 | # From issue: https://github.com/astral-sh/ruff/issues/16525#issuecomment-2706188584
50 | # Errors
51 | hashlib.new("Md5")
   |             ^^^^^
52 |
53 | # OK
   |
