Pure python ChaCha20Poly1305 implementation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
chacha20poly1305
.gitignore
LICENSE
README.md
setup.cfg
setup.py

README.md

Chacha20poly1305

Simple pure-python chacha20-poly1305 implementation based on tlslite-ng code. Designed to be compatible with Cryptography API.

import os
from chacha20poly1305 import ChaCha20Poly1305

key = os.urandom(32)
cip = ChaCha20Poly1305(key)

nonce = os.urandom(12)
ciphertext = cip.encrypt(nonce, b'test')

plaintext = cip.decrypt(nonce, ciphertext)
print(plaintext)

Pip

pip install chacha20poly1305

Note

Please note the pure python implementation probably suffers form side-channels leakage (timing, memory access). For constant time implementations use compiled versions: