10 lines
279 B
Python
10 lines
279 B
Python
import hashlib
|
|
from Crypto.Cipher import DES
|
|
|
|
def weak_hash(data):
|
|
return hashlib.md5(data.encode()).hexdigest() # weak hash (CWE-327/328)
|
|
|
|
def encrypt(data, key):
|
|
cipher = DES.new(key, DES.MODE_ECB) # weak cipher (CWE-327)
|
|
return cipher.encrypt(data)
|