--- id: pysodium version: "0.7.18" license: BSD license_treatment: permissive maintenance: active --- # pysodium — python libsodium wrapper License: permissive · Maintenance: active · Downloads: 391.1K/mo ## What it is and what it does Pysodium exposes libsodium's cryptographic primitives to Python as a thin wrapper, providing direct access to authenticated encryption schemes (ChaCha20-Poly1305, AES-GCM variants), public-key cryptography (Curve25519), digital signatures (Ed25519), hashing (BLAKE2, SHA-512), and password hashing (Argon2, scrypt). It is designed for developers who want libsodium's battle-tested algorithms without the overhead of higher-level abstractions. The package trades ease of use for directness: you work with raw bytes, manage nonces and keys yourself, and call low-level functions that map almost one-to-one to libsodium's C API. This makes it suitable for applications where you need fine-grained control over cryptographic operations, but it requires understanding the underlying primitives and their correct usage patterns. Use it for: - Encrypt and decrypt messages with authenticated encryption (ChaCha20-Poly1305, AES-GCM) for secure communication. - Perform Diffie-Hellman key exchange using Curve25519 to establish shared secrets between parties. - Sign and verify messages using Ed25519 for non-repudiation and authenticity verification. - Hash passwords with Argon2 or scrypt for secure credential storage. - Generate and verify message authentication codes (HMAC-SHA256/512) for data integrity. - Stream encryption with ChaCha20 for large data or streaming scenarios. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pysodium is a Python wrapper around libsodium that provides access to authenticated encryption, key exchange, signing, hashing, and password hashing functions. Yes, if you have libsodium already installed or can install it on your system and need direct access to libsodium's cryptographic functions. The high install friction (external C dependency) and Beta status are real drawbacks, but the package is actively maintained, has no known vulnerabilities, and offers a permissive license. Consider it when you need low-level control over cryptographic primitives that higher-level libraries may not expose. ## Install pip install pysodium uv add pysodium poetry add pysodium ## Installing pysodium Before you install: Installation requires a pre-built libsodium library already present on the system, creating high friction for users unfamiliar with system-level dependency management. The package is actively maintained with recent commits, but the external compiled dependency is a significant barrier. License in practice: BSD permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects that can satisfy the system dependency requirement. Quickstart: import pysodium # Generate a keypair for public-key encryption pk, sk = pysodium.crypto_box_keypair() # Encrypt a message nonce = pysodium.randombytes(pysodium.crypto_box_NONCEBYTES) ciphertext = pysodium.crypto_box(b'hello', nonce, pk, sk) libsodium must be pre-installed on the system; pysodium is a wrapper and cannot function without it. Verify before relying: - Whether libsodium installation is straightforward on all major platforms (Windows, macOS, Linux). - Performance characteristics compared to pure-Python or alternative cryptography libraries. - Whether the package is suitable for production use given its Beta development status. ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: high - Maintenance: active - Downloads: 391.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags libsodium python wrapper, authenticated encryption python, chacha20poly1305 python, nacl cryptography library, curve25519 key exchange, blake2 hashing python, argon2 password hashing, cryptography, system-dependency, low-level-api [View on SkillFed](https://skillfed.io/packages/pysodium) · [View on PyPI](https://pypi.org/project/pysodium/)