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

Function process

encrypt_lib/xchacha20.py:7–18  ·  view source on GitHub ↗
(data, args)

Source from the content-addressed store, hash-verified

5import hashlib
6
7def process(data, args):
8 try:
9 from Crypto.Cipher import ChaCha20_Poly1305
10 except Exception:
11 raise RuntimeError("pycryptodome is required for xchacha20 plugin")
12
13 key = os.urandom(32)
14 nonce = os.urandom(24)
15 cipher = ChaCha20_Poly1305.new(key=key, nonce=nonce)
16 ciphertext, tag = cipher.encrypt_and_digest(data)
17 final = key + nonce + tag + ciphertext
18 return final

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected