Skip to main content

Python binding to the Networking and Cryptography (NaCl) library

Project description

Latest Version https://codecov.io/github/pyca/pynacl/coverage.svg?branch=main Compatible Python Versions

PyNaCl is a Python binding to libsodium, which is a fork of the Networking and Cryptography library. These libraries have a stated goal of improving usability, security and speed. It supports Python 3.6+ as well as PyPy 3.

Features

  • Digital signatures

  • Secret-key encryption

  • Public-key encryption

  • Hashing and message authentication

  • Password based key derivation and password hashing

Changelog

Installation

Binary wheel install

PyNaCl ships as a binary wheel on macOS, Windows and Linux manylinux1 [1] , so all dependencies are included. Make sure you have an up-to-date pip and run:

$ pip install pynacl

Faster wheel build

You can define the environment variable LIBSODIUM_MAKE_ARGS to pass arguments to make and enable parallelization:

$ LIBSODIUM_MAKE_ARGS=-j4 pip install pynacl

Linux source build

PyNaCl relies on libsodium, a portable C library. A copy is bundled with PyNaCl so to install you can run:

$ pip install pynacl

If you’d prefer to use the version of libsodium provided by your distribution, you can disable the bundled copy during install by running:

$ SODIUM_INSTALL=system pip install pynacl

Changelog

1.5.0 (2022-01-07)

  • BACKWARDS INCOMPATIBLE: Removed support for Python 2.7 and Python 3.5.

  • BACKWARDS INCOMPATIBLE: We no longer distribute manylinux1 wheels.

  • Added manylinux2014, manylinux_2_24, musllinux, and macOS universal2 wheels (the latter supports macOS arm64).

  • Update libsodium to 1.0.18-stable (July 25, 2021 release).

  • Add inline type hints.

1.4.0 (2020-05-25)

  • Update libsodium to 1.0.18.

  • BACKWARDS INCOMPATIBLE: We no longer distribute 32-bit manylinux1 wheels. Continuing to produce them was a maintenance burden.

  • Added support for Python 3.8, and removed support for Python 3.4.

  • Add low level bindings for extracting the seed and the public key from crypto_sign_ed25519 secret key

  • Add low level bindings for deterministic random generation.

  • Add wheel and setuptools setup_requirements in setup.py (#485)

  • Fix checks on very slow builders (#481, #495)

  • Add low-level bindings to ed25519 arithmetic functions

  • Update low-level blake2b state implementation

  • Fix wrong short-input behavior of SealedBox.decrypt() (#517)

  • Raise CryptPrefixError exception instead of InvalidkeyError when trying to check a password against a verifier stored in a unknown format (#519)

  • Add support for minimal builds of libsodium. Trying to call functions not available in a minimal build will raise an UnavailableError exception. To compile a minimal build of the bundled libsodium, set the SODIUM_INSTALL_MINIMAL environment variable to any non-empty string (e.g. SODIUM_INSTALL_MINIMAL=1) for setup.

1.3.0 2018-09-26

  • Added support for Python 3.7.

  • Update libsodium to 1.0.16.

  • Run and test all code examples in PyNaCl docs through sphinx’s doctest builder.

  • Add low-level bindings for chacha20-poly1305 AEAD constructions.

  • Add low-level bindings for the chacha20-poly1305 secretstream constructions.

  • Add low-level bindings for ed25519ph pre-hashed signing construction.

  • Add low-level bindings for constant-time increment and addition on fixed-precision big integers represented as little-endian byte sequences.

  • Add low-level bindings for the ISO/IEC 7816-4 compatible padding API.

  • Add low-level bindings for libsodium’s crypto_kx… key exchange construction.

  • Set hypothesis deadline to None in tests/test_pwhash.py to avoid incorrect test failures on slower processor architectures. GitHub issue #370

1.2.1 - 2017-12-04

  • Update hypothesis minimum allowed version.

  • Infrastructure: add proper configuration for readthedocs builder runtime environment.

1.2.0 - 2017-11-01

  • Update libsodium to 1.0.15.

  • Infrastructure: add jenkins support for automatic build of manylinux1 binary wheels

  • Added support for SealedBox construction.

  • Added support for argon2i and argon2id password hashing constructs and restructured high-level password hashing implementation to expose the same interface for all hashers.

  • Added support for 128 bit siphashx24 variant of siphash24.

  • Added support for from_seed APIs for X25519 keypair generation.

  • Dropped support for Python 3.3.

1.1.2 - 2017-03-31

  • reorder link time library search path when using bundled libsodium

1.1.1 - 2017-03-15

  • Fixed a circular import bug in nacl.utils.

1.1.0 - 2017-03-14

  • Dropped support for Python 2.6.

  • Added shared_key() method on Box.

  • You can now pass None to nonce when encrypting with Box or SecretBox and it will automatically generate a random nonce.

  • Added support for siphash24.

  • Added support for blake2b.

  • Added support for scrypt.

  • Update libsodium to 1.0.11.

  • Default to the bundled libsodium when compiling.

  • All raised exceptions are defined mixing-in nacl.exceptions.CryptoError

1.0.1 - 2016-01-24

  • Fix an issue with absolute paths that prevented the creation of wheels.

1.0 - 2016-01-23

  • PyNaCl has been ported to use the new APIs available in cffi 1.0+. Due to this change we no longer support PyPy releases older than 2.6.

  • Python 3.2 support has been dropped.

  • Functions to convert between Ed25519 and Curve25519 keys have been added.

0.3.0 - 2015-03-04

  • The low-level API (nacl.c.*) has been changed to match the upstream NaCl C/C++ conventions (as well as those of other NaCl bindings). The order of arguments and return values has changed significantly. To avoid silent failures, nacl.c has been removed, and replaced with nacl.bindings (with the new argument ordering). If you have code which calls these functions (e.g. nacl.c.crypto_box_keypair()), you must review the new docstrings and update your code/imports to match the new conventions.

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

PyNaCl-1.5.0.tar.gz (3.4 MB view details)

Uploaded Source

Built Distributions

PyNaCl-1.5.0-cp36-abi3-win_amd64.whl (212.1 kB view details)

Uploaded CPython 3.6+ Windows x86-64

PyNaCl-1.5.0-cp36-abi3-win32.whl (204.6 kB view details)

Uploaded CPython 3.6+ Windows x86

PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6+ musllinux: musl 1.1+ x86-64

PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_aarch64.whl (663.8 kB view details)

Uploaded CPython 3.6+ musllinux: musl 1.1+ ARM64

PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ x86-64

PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856.7 kB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.24+ x86-64

PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (680.1 kB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ARM64

PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (601.7 kB view details)

Uploaded CPython 3.6+ manylinux: glibc 2.17+ ARM64 manylinux: glibc 2.24+ ARM64

PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl (349.9 kB view details)

Uploaded CPython 3.6+ macOS 10.10+ universal2 (ARM64, x86-64)

File details

Details for the file PyNaCl-1.5.0.tar.gz.

File metadata

  • Download URL: PyNaCl-1.5.0.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for PyNaCl-1.5.0.tar.gz
Algorithm Hash digest
SHA256 8ac7448f09ab85811607bdd21ec2464495ac8b7c66d146bf545b0f08fb9220ba
MD5 93989045e25f1111452cfdf5e021814d
BLAKE2b-256 a72227582568be639dfe22ddb3902225f91f2f17ceff88ce80e4db396c8986da

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-win_amd64.whl.

File metadata

  • Download URL: PyNaCl-1.5.0-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 212.1 kB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 20f42270d27e1b6a29f54032090b972d97f0a1b0948cc52392041ef7831fee93
MD5 c8b8dd769782cf55424df4d408fc77e1
BLAKE2b-256 5e22d3db169895faaf3e2eda892f005f433a62db2decbcfbc2f61e6517adfa87

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-win32.whl.

File metadata

  • Download URL: PyNaCl-1.5.0-cp36-abi3-win32.whl
  • Upload date:
  • Size: 204.6 kB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543
MD5 8e51974faf14142f881b6afd478ce2b9
BLAKE2b-256 252db7df6ddb0c2a33afdb358f8af6ea3b8c4d1196ca45497dd37a56f0c122be

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_x86_64.whl.

File metadata

  • Download URL: PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6+, musllinux: musl 1.1+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 61f642bf2378713e2c2e1de73444a3778e5f0a38be6fee0fe532fe30060282ff
MD5 a1402876cfad3c019793d30ddbb9668d
BLAKE2b-256 fd1acc308a884bd299b651f1633acb978e8596c71c33ca85e9dc9fa33a5399b9

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_aarch64.whl.

File metadata

  • Download URL: PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 663.8 kB
  • Tags: CPython 3.6+, musllinux: musl 1.1+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b
MD5 9f2ad04e49f230f435e60f3de84f8306
BLAKE2b-256 3d85c262db650e86812585e2bc59e497a8f59948a005325a11bbbc9ecd3fe26b

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06b8f6fa7f5de8d5d2f7573fe8c863c051225a27b61e6860fd047b1775807858
MD5 4e0f21f352ced5fe2a5da755db62764c
BLAKE2b-256 6628ca86676b69bf9f90e710571b67450508484388bfce09acf8a46f0b8c785f

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0c84947a22519e013607c9be43706dd42513f9e6ae5d39d3613ca1e142fba44d
MD5 e3607f5868ae28a26b00e7026c38f823
BLAKE2b-256 ee87f1bb6a595f14a327e8285b9eb54d41fef76c585a0edef0a45f6fc95de125

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a36d4a9dda1f19ce6e03c9a784a2921a4b726b02e1c736600ca9c22029474394
MD5 2c51c427c6a122c14e26167a95bdfcd6
BLAKE2b-256 5d7087a065c37cca41a75f2ce113a5a2c2aa7533be648b184ade58971b5f7ccc

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 52cb72a79269189d4e0dc537556f4740f7f0a9ec41c1322598799b0bdad4ef92
MD5 141d8fc4b04bfb77089c90dcead1e050
BLAKE2b-256 59bbfddf10acd09637327a97ef89d2a9d621328850a72f1fdc8c08bdf72e385f

See more details on using hashes here.

Provenance

File details

Details for the file PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl.

File metadata

  • Download URL: PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl
  • Upload date:
  • Size: 349.9 kB
  • Tags: CPython 3.6+, macOS 10.10+ universal2 (ARM64, x86-64)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl
Algorithm Hash digest
SHA256 401002a4aaa07c9414132aaed7f6836ff98f59277a234704ff66878c2ee4a0d1
MD5 9a54798738f90a6cce1079c62f4f4628
BLAKE2b-256 ce750b8ede18506041c0bf23ac4d8e2971b4161cd6ce630b177d0a08eb0d8857

See more details on using hashes here.

Provenance

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