Skip to main content

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:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chacha20poly1305-0.0.3.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file chacha20poly1305-0.0.3.tar.gz.

File metadata

  • Download URL: chacha20poly1305-0.0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for chacha20poly1305-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f2f005c7cf4638ffa4ff06c02c78748068b642916795c6d16c7cc5e355e70edf
MD5 2ebc84cfa7aba98c291b6fa2680ec68c
BLAKE2b-256 382c5b4eb73c5cb30ded3082af025e76f529764971c57c02b101e842ff998f63

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 file

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page