(data, args)
| 5 | import hashlib |
| 6 | |
| 7 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected