Skip to main content

pyrind

Cryptography for Python from rind, a pure-Rust library: AEADs, hashes, HMAC, HKDF, PBKDF2, X25519, Ed25519, ECDSA and ECDH, RSA, and ML-KEM, with rind's own misuse-resistant API.

pip install pyrind

Why

A Python call into pyca/cryptography pays OpenSSL 3's per-call setup, which dwarfs the work on a small message. pyrind's calls go straight to rind's assembly.

On an Intel Core i7-8700 (Coffee Lake, 2017), Linux 6.18, CPython 3.14.8, against cryptography 50.0.2 on OpenSSL 3.5.9, one call at a time with its inputs in hand, fastest of seven runs:

Operation pyrind cryptography hashlib, hmac cryptography ÷ pyrind
SHA-256, 21 B 262 ns 1.79 µs 526 ns 6.8x
HMAC-SHA256, 21 B 401 ns 2.54 µs 1.87 µs 6.3x
HKDF-SHA256, 32 B key 1.68 µs 5.07 µs - 3.0x
AES-128-GCM seal, 32 B 237 ns 667 ns - 2.8x
AES-128-GCM open, 32 B 218 ns 690 ns - 3.2x
AES-128-GCM seal, 1350 B 507 ns 924 ns - 1.8x
AES-128-GCM open, 1350 B 472 ns 926 ns - 2.0x
AES-128-GCM seal, 16384 B 3.04 µs 3.63 µs - 1.2x
AES-128-GCM open, 16384 B 3.02 µs 3.59 µs - 1.2x
ChaCha20-Poly1305 seal, 32 B 315 ns 858 ns - 2.7x
ChaCha20-Poly1305 open, 32 B 293 ns 894 ns - 3.0x
ChaCha20-Poly1305 seal, 1350 B 930 ns 1.54 µs - 1.7x
ChaCha20-Poly1305 open, 1350 B 901 ns 1.59 µs - 1.8x
ChaCha20-Poly1305 seal, 16384 B 7.13 µs 7.66 µs - 1.1x
ChaCha20-Poly1305 open, 16384 B 7.03 µs 7.72 µs - 1.1x
X25519 agree 19.93 µs 30.44 µs - 1.5x
ECDH P-256 agree 37.44 µs 62.57 µs - 1.7x
Ed25519 sign, 21 B 7.10 µs 28.96 µs - 4.1x
Ed25519 verify, 21 B 29.07 µs 93.03 µs - 3.2x
ECDSA P-256 sign, 21 B 14.41 µs 26.14 µs - 1.8x
ECDSA P-256 verify, 21 B 39.42 µs 60.53 µs - 1.5x
RSA-2048 PKCS#1 sign, 21 B 470.21 µs 483.67 µs - 1.0x
RSA-2048 PKCS#1 verify, 21 B 11.00 µs 20.14 µs - 1.8x
ML-KEM-768 encapsulate 3.22 µs 22.16 µs - 6.9x
ML-KEM-768 decapsulate 7.78 µs 33.81 µs - 4.3x

The gap is widest on small messages and short-lived keys, which is where protocols spend their calls. On 16 KiB the assembly dominates both and the two converge; RSA signing is the same modular exponentiation in each.

Run sh/python.sh bench in the repository for your own machine's numbers.

Use

Each rind module is a submodule. Algorithms are constants, and a key is made for one algorithm, so the wrong combination fails before any data moves: passing a hash where a key wants an AEAD algorithm raises TypeError.

import os
from pyrind import aead, digest, hkdf, hmac, signature
from pyrind.signature import sign, verify

# Hashes and MACs.
digest.digest(digest.SHA256, b"hello")
key = hmac.Key(hmac.HMAC_SHA256, b"secret")
tag = hmac.sign(key, b"message")
hmac.verify(key, b"message", tag)  # raises pyrind.BadSignature on a mismatch

# AEAD with the caller's nonces, which must never repeat under one key. The
# associated data is keyword-only, so it can't be swapped with the plaintext.
key = aead.Key(aead.AES_256_GCM, os.urandom(32))
sealed = key.seal(bytes(12), b"plaintext", aad=b"header")
assert key.open(bytes(12), sealed, aad=b"header") == b"plaintext"

# Or random 192-bit nonces, with no nonce state.
key = aead.RandomizedNonceKey(os.urandom(32))
nonce, sealed = key.seal(b"plaintext", aad=b"")
assert key.open(nonce, sealed, aad=b"") == b"plaintext"

# HKDF expands straight into keys, whose bytes never reach Python.
prk = hkdf.Salt(hkdf.HKDF_SHA256, b"salt").extract(b"input key material")
aead_key = prk.expand(b"aead", aead.AES_256_GCM)

# Signatures: a key pair signs with a `sign` algorithm, and a peer's public
# key is parsed for a `verify` algorithm.
key_pair = signature.EcdsaKeyPair.generate(sign.ECDSA_P256_SHA256_ASN1)
signed = key_pair.sign(b"message")
public_key = signature.PublicKey(verify.ECDSA_P256_SHA256_ASN1, bytes(key_pair.public_key()))
public_key.verify(b"message", signed)

The modules are aead, agreement (X25519 and ECDH), cpu, digest, hkdf, hmac, kem (ML-KEM-768), pbkdf2, rsa (RSA-OAEP), and signature (ECDSA, Ed25519, and RSA). Algorithms only legacy protocols should use, such as SHA-1 and MD5, live in each module's legacy submodule. Keys load from and encode to PKCS#8, SEC1, PKCS#1, and SubjectPublicKeyInfo DER. The package ships type stubs, and rind's documentation describes each operation in depth.

Every failure raises a subclass of pyrind.Error: WrongLength, KeyRejected (whose message says why), BadSignature, DecryptFailed, RngFailed, Unsupported, or Fault. Arguments take any bytes-like object; anything but bytes is copied first, so no other thread can change it mid-call. RSA key generation, RSA signing and decryption, and PBKDF2 release the GIL while they run.

pyrind wipes keys and keyed state when Python frees them exactly when rind does, through rind's own drops; the wheels build rind with its default features. Nothing wipes the bytes a key was loaded from or exported to; Python owns those.

Platforms

Wheels cover CPython 3.11 and later through the stable ABI, on Linux (glibc 2.17 and later on x86_64, aarch64, and armv7; musl on x86_64 and aarch64), macOS on x86_64 and Apple silicon, and Windows on x86_64 and aarch64. PyPy, free-threaded CPython, and other platforms build the sdist, which needs a Rust toolchain. rind runs only on x86_64, aarch64, and 32-bit arm, so other architectures fail to build; there is no pure-Python fallback.

Importing pyrind raises ImportError on a CPU missing a feature rind requires, naming it, rather than failing later.

License

pyrind carries rind's licenses: rind's own code is Apache-2.0, ISC, or MIT-0, at your option, and the code it copies keeps its source's license, as LICENSE lists.

Metadata

Release files for pyrind 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrind 0.1.1
File Size Uploaded Provenance Actions
pyrind-0.1.1.tar.gz 2.4 MB With provenance Details for pyrind-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyrind 0.1.1
File Actions
pyrind-0.1.1-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for pyrind-0.1.1-cp311-abi3-win_arm64.whl
pyrind-0.1.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for pyrind-0.1.1-cp311-abi3-win_amd64.whl
pyrind-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for pyrind-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl
pyrind-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for pyrind-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl
pyrind-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for pyrind-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pyrind-0.1.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.11 abi3 Linux glibc 2.17+ ARMv7l Details for pyrind-0.1.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
pyrind-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for pyrind-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pyrind-0.1.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for pyrind-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
pyrind-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for pyrind-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 11.9 MB

Release files / pyrind-0.1.1.tar.gz

Download URL pyrind-0.1.1.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
749c0339118617e432eb1008fef0a6a6680fbf21f8dffd24d2634a21866b7044
BLAKE2b-256 checksum
How to use checksums
2a85222907ab740c651ab2047fdd8728253496f65995b644b19293159f426fc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-win_arm64.whl

Download URL pyrind-0.1.1-cp311-abi3-win_arm64.whl
Size 778.6 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
14b23ea89b790b12376e1f08a4539975e85894ea78f5c648528cfc8347111a11
BLAKE2b-256 checksum
How to use checksums
67d970e52c8d01b9cb45e24e6e71f89e9e3572c65210b17424c282bc4361c4f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-win_amd64.whl

Download URL pyrind-0.1.1-cp311-abi3-win_amd64.whl
Size 1.0 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3f994f8b76d04ad24803d4e72c99425bdd73c9ac1510bcc46746c73c9aa1cb0e
BLAKE2b-256 checksum
How to use checksums
5f792fcab689dae77f1a55824e379301ce5c4810d53b23d6eef81840642d7c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL pyrind-0.1.1-cp311-abi3-musllinux_1_2_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
e1349f43908a6bc7e8d6a0504add1bfd7e163534271dd0460b3a30d0f0c378bf
BLAKE2b-256 checksum
How to use checksums
c7a53e4466aa4b3f5d4b7094522b4babab15b40a0e8dcaf9b2e0d6485bc626cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL pyrind-0.1.1-cp311-abi3-musllinux_1_2_aarch64.whl
Size 1.2 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
ecf5d6ebbaa0a79dccf61509784a812e36bbc2536f0c9ec082d0191b1fb76c6c
BLAKE2b-256 checksum
How to use checksums
5256d9d0902ead80940715c79cb63744348450b468b97baafc87ceb974eb82be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyrind-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
384a3d7933ad917dba362376b8d4275a11baac90a39faf1ae9c3cb7767142284
BLAKE2b-256 checksum
How to use checksums
83cc32196547c66e8e1f5363a779596068f07fd0972f2cf3504964c2a270251d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL pyrind-0.1.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 987.7 kB
Tags CPython 3.11 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
b693561e5a3a1556e021b64999c6e776d63d710ecd4c68915131682b8e6184fd
BLAKE2b-256 checksum
How to use checksums
c5fa13eca3e4491b425bcec793f7379372be92d404c61f0b391640fbeeb67d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyrind-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 975.2 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
bd4c7136c6d9e59655fb81a37544a2b11138afb74ce631932f7e47da178a4105
BLAKE2b-256 checksum
How to use checksums
8d40f6948d6256a87fe012e4758e363e07d7420fa225f3c2c738272e4cc998ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL pyrind-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
Size 907.4 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5ac1e914ee8eff6b22b55d5fd960459f5573cd8bca9f561cecabd1754cc37180
BLAKE2b-256 checksum
How to use checksums
2760cd9c0377bbe2c06a146d1d43efbdb39d37a0020c4f2ba4d48a85d6ade112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pyrind-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL pyrind-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
818159e8f3102e7fd19f86a1c24f440bb63ae2fab65ddf9ea4d138bcd02e8b75
BLAKE2b-256 checksum
How to use checksums
6ec2a05e4aace20dd88a5fa33279273518922a54746042b2e4a19dbd879277f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for pyrind 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for pyrind-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

10 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page