MCPcopy Create free account
hub / github.com/echQoQ/RustSL / process

Function process

encrypt_lib/aes.py:12–28  ·  view source on GitHub ↗
(data, args)

Source from the content-addressed store, hash-verified

10 return sha.digest()
11
12def process(data, args):
13 try:
14 from Crypto.Cipher import AES
15 from Crypto.Util.Padding import pad
16 except Exception:
17 raise RuntimeError('pycryptodome is required for aes plugin')
18
19 # generate key and iv
20 key = os.urandom(32)
21 iv = os.urandom(16)
22
23 padded_data = pad(data, AES.block_size)
24 cipher = AES.new(key, AES.MODE_CBC, iv)
25 encrypted = cipher.encrypt(padded_data)
26 hash1 = sha256_bytes(data)
27 final = key + iv + hash1 + encrypted
28 return final

Callers

nothing calls this directly

Calls 1

sha256_bytesFunction · 0.70

Tested by

no test coverage detected