mirror of
https://github.com/stulle123/kakaotalk_analysis.git
synced 2025-05-07 12:06:09 +00:00
16 lines
531 B
Python
16 lines
531 B
Python
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
|
|
_KEY = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
|
|
|
|
|
def aes_encrypt(plaintext, iv):
|
|
cipher = Cipher(algorithms.AES(_KEY), modes.CFB(iv))
|
|
encryptor = cipher.encryptor()
|
|
return encryptor.update(plaintext) + encryptor.finalize()
|
|
|
|
|
|
def aes_decrypt(ciphertext, iv):
|
|
cipher = Cipher(algorithms.AES(_KEY), modes.CFB(iv))
|
|
decryptor = cipher.decryptor()
|
|
return decryptor.update(ciphertext) + decryptor.finalize()
|