MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / aes_encrypt

Function aes_encrypt

backend/tkhelper/encryption/aes.py:14–21  ·  view source on GitHub ↗
(plain_text: str)

Source from the content-addressed store, hash-verified

12
13
14def aes_encrypt(plain_text: str):
15 if not AES_ENCRYPTION_KEY_BYTES:
16 raise Exception("AES_ENCRYPTION_KEY is not set")
17 cipher = AES.new(AES_ENCRYPTION_KEY_BYTES, AES.MODE_CBC)
18 ct_bytes = cipher.encrypt(pad(plain_text.encode(), AES.block_size))
19 iv = b64encode(cipher.iv).decode("utf-8")
20 ct = b64encode(ct_bytes).decode("utf-8")
21 return f"{iv},{ct}"
22
23
24def aes_decrypt(encrypted_text: str):

Callers 2

createMethod · 0.90
encryptMethod · 0.90

Calls 3

encryptMethod · 0.45
encodeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected