Skip to main content

Python binding to the Monocypher library

Project description

monocypher-py

Build Status codecov Documentation Status

Python bindings for Monocypher 3.1.0 using the cffi library. Monocypher is a small, fast, easy to deploy, and easy to use cryptography library. monocypher-py provides both high- (a-la PyNaCl) and low-level APIs around Monocypher. There is no aim for drop-down compatibility with PyNaCl (especially since Monocypher uses different primitives compared to NaCl).

high-level api

>>> from monocypher.public import PrivateKey, Box
>>> sk_a = PrivateKey.generate()
>>> sk_b = PrivateKey.generate()
>>> box = Box(sk_a, sk_b.public_key)
>>> box.encrypt(b'hello world!')
b'\xdbZn...'

low-level api

>>> import monocypher.bindings as mc
>>> sk_a_bytes = sk_a.encode()
>>> pk_b_bytes = sk_b.public_key.encode()
>>> shared_key = mc.crypto_key_exchange(sk_a_bytes, pk_b_bytes)
>>> box.shared_key() == shared_key
True

Project details


Download files

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

Source Distribution

monocypher-py-0.0.3.tar.gz (56.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page