bandit/examples/crypto-md5.py
Eric Brown 21de753e29 Add other known weak MD hash modules
hashlib is not the only module to provide MD5 hashes. PyCrypto and
pyca/cryptography also have functions to do MD5 hashes.  This patch
adds those to the md5 blacklist_calls list. This patch also adds
PyCrypto's MD2 and MD4.

Change-Id: Icd55365f1f7a4cbb34dcb55abc0d77ab8a75f575
2015-08-09 02:43:37 -07:00

19 lines
381 B
Python

from cryptography.hazmat.primitives import hashes
from Crypto.Hash import MD2 as pycrypto_md2
from Crypto.Hash import MD4 as pycrypto_md4
from Crypto.Hash import MD5 as pycrypto_md5
import hashlib
hashlib.md5(1)
hashlib.md5(1).hexdigest()
abc = str.replace(hashlib.md5("1"), "###")
print(hashlib.md5("1"))
pycrypto_md2.new()
pycrypto_md4.new()
pycrypto_md5.new()
hashes.MD5()