mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
19 lines
437 B
Python
19 lines
437 B
Python
# snippet from python/ql/test/experimental/library-tests/frameworks/cryptodome/test_rc4.py
|
|
from Cryptodome.Cipher import ARC4, AES
|
|
|
|
import os
|
|
|
|
key = os.urandom(256//8)
|
|
|
|
secret_message = b"secret message"
|
|
|
|
cipher = ARC4.new(key)
|
|
encrypted = cipher.encrypt(secret_message) # NOT OK
|
|
|
|
print(secret_message, encrypted)
|
|
|
|
cipher = AES.new(key, AES.MODE_ECB)
|
|
encrypted = cipher.encrypt(secret_message) # NOT OK
|
|
|
|
print(secret_message, encrypted)
|