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.0

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.0
File Size Uploaded Provenance Actions
pyrind-0.1.0.tar.gz 2.4 MB With provenance Details for pyrind-0.1.0.tar.gz

Built distributions (wheels)

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

Total release size: 11.9 MB

Release files / pyrind-0.1.0.tar.gz

Download URL pyrind-0.1.0.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
1d148f94e7d70be9a432e9b62db6b2bec780c49db12b3371c31ca6f0d98eac18
BLAKE2b-256 checksum
How to use checksums
888be359c1bc4215b21c7c5d6f23048c459b70041f826717164941dd08fbf017
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-cp311-abi3-win_arm64.whl
Size 773.5 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
bbbf9c279cbbaee24c9eac74f1b8258ea15d262e7cb6d25d9ce75431814d98e1
BLAKE2b-256 checksum
How to use checksums
267e475623fe44801bfc3ae550d05bdc2a2e340756c5a19a94feed380d0f6bbe
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-cp311-abi3-win_amd64.whl
Size 1.0 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
651a3772d02432cf67ed392b93acb3cc2268f2c061c5ec0e60db0f53fcbdee0f
BLAKE2b-256 checksum
How to use checksums
e266e0bfc4138887e2c58a0c8b1a290577f1cf9adeeb3cfbc84f81ea4fa21b02
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-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
5fb04ac62c184519aa2bf57ef4212fe18ea4710d9b8cf8a588eb9447fa089bd7
BLAKE2b-256 checksum
How to use checksums
f3c6da46209d97b0c90f08a212a1f50ba8ac9c150cabecfea16bfdac616ef426
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-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
61577ac7ebbe93380eea36b91f39c4516d91174c643d9c4486211b5ea253b71d
BLAKE2b-256 checksum
How to use checksums
5f0e78a60ac80db6a8fb86315fb0bdd33f05e9ba2b091b762101a86cf2c3b115
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-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
76013cc777504d2c66974f9a2356d58c65757ce40b5c3167cf9da03f8f4ed407
BLAKE2b-256 checksum
How to use checksums
c145bbe3878dc86d2787908cf2f6e8aa33b34ef69d0934aa6be70b165145a352
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 988.1 kB
Tags CPython 3.11 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
612848f4d85481eec78f1f4b81a76105f36d5bc64b112b127fc0f77bcf08b70f
BLAKE2b-256 checksum
How to use checksums
3eb937d699377d3cd64c26c3cf3c34f21ded233b8eef8514c4f7b8bf28f87559
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 973.4 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
1151d32f38f9b50465f4dd09497ed0b5157e09664d964eb586f52f5ae5683fe7
BLAKE2b-256 checksum
How to use checksums
670197cc1cfcdf0ec61032197633c829d7da54a41d5d405374f38bdb526f4511
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 908.9 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a4840fd830239b676734f1d7aa3190e7931728f571b71b2d1fbd494efe7e5bf2
BLAKE2b-256 checksum
How to use checksums
eb24bb5cad0aaa17a5af711fab0b83be1e43470b209af80d8eba24694c055ab2
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 7, 2026.

Transparency log

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

Download URL pyrind-0.1.0-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
eedc77c1e3a32b7b86213f7e9b553a1403b0ad3690a33b3f425b1010bef6f1bb
BLAKE2b-256 checksum
How to use checksums
5ef7f9e61ebe90a660ecefa4665ec621763e5bcb8f750a18780f0b5014b72a7c
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 7, 2026.

Transparency log

Security for pyrind 0.1.0

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.0.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 7, 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.0 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