# PyNaCl: Python binding to the libsodium library

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.8+ 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

## Contents

- Public Key Encryption
  - Examples
  - Reference
- Secret Key Encryption
  - Example with SecretBox
  - Example with Aead
  - Requirements
  - Reference
  - Algorithm details
- Digital Signatures
  - Example
  - Example
  - Example
  - Reference
  - Ed25519
- Hashing
  - Integrity check examples
  - Additional hashing usages for `blake2b`
  - Message authentication
  - Key derivation
- Password hashing
  - Hashers and parameters
  - Password storage and verification
  - Key derivation

## Support Features

- Encoders
  - Built in Encoders
  - Defining your own Encoder
- Exceptions
  - PyNaCl specific exceptions
  - PyNaCl exceptions mixing-in standard library ones
  - Utility functions for exception handling
- Utilities
  - `EncryptedMessage`
  - `random()`
  - `randombytes_deterministic()`

Api Documentation

- nacl.hash
  - `sha256()`
  - `sha512()`
  - `blake2b()`
  - `siphash24()`
  - `siphashx24()`
- nacl.pwhash
  - Functions exposed at top level
    - `str()`
    - `verify()`
    - `PASSWD_MIN`
    - `PASSWD_MAX`
    - `PWHASH_SIZE`
    - `OPSLIMIT_MIN`
    - `OPSLIMIT_MAX`
    - `MEMLIMIT_MIN`
    - `MEMLIMIT_MAX`
    - `MEMLIMIT_INTERACTIVE`
    - `OPSLIMIT_INTERACTIVE`
    - `MEMLIMIT_SENSITIVE`
    - `OPSLIMIT_SENSITIVE`
    - `MEMLIMIT_MODERATE`
    - `OPSLIMIT_MODERATE`
  - Per-mechanism password hashing implementation modules
    - nacl.pwhash.argon2id
    - nacl.pwhash.argon2i
    - nacl.pwhash.scrypt
- nacl.hashlib
  - `blake2b`
    - `blake2b.MAX_DIGEST_SIZE`
    - `blake2b.MAX_KEY_SIZE`
    - `blake2b.PERSON_SIZE`
    - `blake2b.SALT_SIZE`
  - `scrypt()`

The PyNaCl open source project

- Installation
  - Binary wheel install
  - Faster wheel build
  - Linux source build
- Doing A Release
- Reference vectors
  - Imported reference vectors
  - Custom generated reference vectors
- Changelog
  - 1.6.2 (2026-01-01)
  - 1.6.1 (2025-11-10)
  - 1.6.0 (2025-09-11)
  - 1.5.0 (2022-01-07)
  - 1.4.0 (2020-05-25)
  - 1.3.0 2018-09-26
  - 1.2.1 - 2017-12-04
  - 1.2.0 - 2017-11-01
  - 1.1.2 - 2017-03-31
  - 1.1.1 - 2017-03-15
  - 1.1.0 - 2017-03-14
  - 1.0.1 - 2016-01-24
  - 1.0 - 2016-01-23
  - 0.3.0 - 2015-03-04

### Indices and tables

- Index

- Module Index

- Search Page