Skip to main content

pyyescrypt

Python bindings for yescrypt, implemented as a small Go shared library loaded via ctypes.

No CPython C extension code. The Python package is pure Python, plus a platform-specific shared library:

  • macOS: libyescrypt.dylib
  • Linux (glibc): libyescrypt.so

Windows is currently unsupported because the Go-based build has only been validated on macOS and glibc-based Linux.

Public API

import pyyescrypt

hash_str = pyyescrypt.generate_hash("my password")
ok = pyyescrypt.verify_hash("my password", hash_str)
  • generate_hash(password: str) -> str returns a modular-crypt yescrypt hash string (typically starts with $y$).
  • verify_hash(password: str, hash_str: str) -> bool verifies a password against a stored hash string.

Errors raised from the native layer become ValueError in Python.

Command-line interface

Installing pyyescrypt also provides a pyyescrypt-cli executable (packaged Go binary). It exposes the same operations as the Python module:

# Generate a hash (reads the password from stdin)
printf "secret" | pyyescrypt-cli generate

# Verify returns exit status 0 on success and prints "1"
printf "secret" | pyyescrypt-cli verify --hash '$y$...'

The Python package automatically falls back to this CLI whenever the shared library cannot be loaded (for example on musl-based systems), and you can force it via PYYESCRYPT_BACKEND=cli.

Repo layout

  • capi/ Go code compiled as a C-shared library (-buildmode=c-shared)
  • src/pyyescrypt/_native.py loads the shared library with ctypes and exposes the Python API
  • src/pyyescrypt/_native/ destination directory for the built shared library
  • tests/ Python tests (ABI-level tests via ctypes)

Requirements

  • Go toolchain available on PATH
  • Python 3.10+ required
  • On macOS, Xcode Command Line Tools installed (xcode-select --install)

Build the native library

make native

This builds the shared library into:

  • src/pyyescrypt/_native/libyescrypt.dylib on macOS
  • src/pyyescrypt/_native/libyescrypt.so on Linux

To build the bundled CLI (used automatically on musl) run:

make cli

which outputs src/pyyescrypt/_cli/pyyescrypt-cli.

Run tests

make test

This will:

  • run go test -cover ./...
  • create a local virtualenv at .venv
  • install test dependencies into the venv
  • build the native library
  • run pytest

If you want only the Python tests:

make py-test

Development notes

Why ctypes instead of a CPython extension

CPython extension modules require a C ABI boundary anyway. This project avoids the CPython C-API completely by exporting a small C ABI from Go and calling it from Python using ctypes.

Memory ownership

Native functions return char* allocated by the native library. Python must free them by calling yc_free. The Python wrapper handles this.

Linux libc notes

glibc-based distros (manylinux wheels) are fully supported today. Musl-based systems such as Alpine cannot load the Go-built shared library because Go currently emits initial-exec TLS relocations for -buildmode=c-shared, which musl's dynamic loader refuses. Installing the wheel on Alpine succeeds, but the native backend fails to import.

The package now ships a small Go CLI binary that the Python module falls back to automatically whenever the native backend cannot be loaded (or when PYYESCRYPT_BACKEND=cli is set). Set PYYESCRYPT_BACKEND=native if you prefer to fail fast when the shared library is unavailable.

Packaging

The wheel must include the shared library under pyyescrypt/_native/.

For local development, make native places the library in the repo tree where the tests expect it.

To validate packaging, use a separate workflow:

  1. build a wheel
  2. install it into a clean venv
  3. import pyyescrypt and run the tests against the installed package data

License

See LICENSE.

Metadata

Release files for pyyescrypt 0.1.17

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

Source distribution (sdist)

Source distribution for pyyescrypt 0.1.17
File Size Uploaded Provenance Actions
pyyescrypt-0.1.17.tar.gz 23.9 kB Without provenance Details for pyyescrypt-0.1.17.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyyescrypt 0.1.17
File Actions
pyyescrypt-0.1.17-cp314-cp314-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ x86-64 Details for pyyescrypt-0.1.17-cp314-cp314-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.17-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details for pyyescrypt-0.1.17-cp314-cp314-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.17-cp314-cp314-macosx_13_0_arm64.whl CPython 3.14 CPython 3.14 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.17-cp314-cp314-macosx_13_0_arm64.whl
pyyescrypt-0.1.17-cp313-cp313-musllinux_1_2_x86_64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ x86-64 Details for pyyescrypt-0.1.17-cp313-cp313-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.17-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for pyyescrypt-0.1.17-cp313-cp313-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.17-cp313-cp313-macosx_13_0_arm64.whl CPython 3.13 CPython 3.13 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.17-cp313-cp313-macosx_13_0_arm64.whl
pyyescrypt-0.1.17-cp312-cp312-musllinux_1_2_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.2+ x86-64 Details for pyyescrypt-0.1.17-cp312-cp312-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.17-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for pyyescrypt-0.1.17-cp312-cp312-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.17-cp312-cp312-macosx_13_0_arm64.whl CPython 3.12 CPython 3.12 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.17-cp312-cp312-macosx_13_0_arm64.whl
pyyescrypt-0.1.17-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details for pyyescrypt-0.1.17-cp311-cp311-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.17-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details for pyyescrypt-0.1.17-cp311-cp311-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.17-cp311-cp311-macosx_13_0_arm64.whl CPython 3.11 CPython 3.11 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.17-cp311-cp311-macosx_13_0_arm64.whl

Total release size: 19.3 MB

Release files / pyyescrypt-0.1.17.tar.gz

Download URL pyyescrypt-0.1.17.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4c4ba1f41a298dce9c2b190d298e6e3e5c56d895342dc102b010e3f9f9fa912f
BLAKE2b-256 checksum
How to use checksums
8684b56c6708d0bc9289e554f1c3a26786f3b3866580ddb71d5b4cd70210861c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.17-cp314-cp314-musllinux_1_2_x86_64.whl
Size 1.6 MB
Tags CPython 3.14 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
48331549d7a0e554ce6827049f5c84728e285a9a3c4ed08694054d6ea9929400
BLAKE2b-256 checksum
How to use checksums
d75847d5df8ffa82658222ff91069b638e7cedec7677ef6a44baff9b0597b90d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.17-cp314-cp314-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
13cf54397789524295039f4e14f8f3f855f2f34817057c0cbf03ebb4dcd7b2f1
BLAKE2b-256 checksum
How to use checksums
f2f8b8ac0640facea476d1151c6748c7d3994ee539e1d5b84212e012e2eeca2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp314-cp314-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.17-cp314-cp314-macosx_13_0_arm64.whl
Size 1.6 MB
Tags CPython 3.14 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
1d2a52030d8ef1aa7622aa49fde0355865beda6c1e31035673a6e4b2bf3b5dd8
BLAKE2b-256 checksum
How to use checksums
ee5568df0deb3ee57e1343c4a09c1a491e9904bc3de548aba3764b22023d7069
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.17-cp313-cp313-musllinux_1_2_x86_64.whl
Size 1.6 MB
Tags CPython 3.13 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
8538b1fbd950af164ee7c7d4f5518025d7ce6755d412695022fa428cd9ebd0e3
BLAKE2b-256 checksum
How to use checksums
1159b0feb4379110f5a2548cf812f1a4daad74c2d89390c2c66b121f9b370d1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.17-cp313-cp313-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
20d52364591200ce2a01210adf00f917d4c7809b4e55740996c580dc1f19d967
BLAKE2b-256 checksum
How to use checksums
a4d7a09e8679494e00c504507a91421706042b6507cae7e12a9b0f42949c1a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp313-cp313-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.17-cp313-cp313-macosx_13_0_arm64.whl
Size 1.6 MB
Tags CPython 3.13 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
3dd93c062e2a2deaeef8be61b794576221e94c8501d2899e87a0969cfe01082b
BLAKE2b-256 checksum
How to use checksums
6ac11eaeae4d3ffede84dd2425d2fa7c7690fc297f9fae23069ca3de22ae4481
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.17-cp312-cp312-musllinux_1_2_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
d40f7c91e23f11f62bbe098f726686cded9ff401abe0c05711b9c12eaa7f46f3
BLAKE2b-256 checksum
How to use checksums
5b9daaa7ac1fa0d946e2abc4abac702f240483f0c366058063d6bbbc0d208edd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.17-cp312-cp312-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
01b831bd5223aa573fbd4332a84c8406a0a45f7b4e9d6200a2d8b04e872ede74
BLAKE2b-256 checksum
How to use checksums
9e85bf14fdcb4b7fba3971b66bf537484d73facd00efdb3be4579e0df9e15c29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp312-cp312-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.17-cp312-cp312-macosx_13_0_arm64.whl
Size 1.6 MB
Tags CPython 3.12 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
720ac13a5df69ffb716ade0927ec34c73bc5e00af4945c830d7cdd4c03d52a78
BLAKE2b-256 checksum
How to use checksums
7dc872f9be14ecea07f5c1c08c9ea98d6ddc34ea160919130ffc3f23874505c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.17-cp311-cp311-musllinux_1_2_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
d7ecaa47fe9424a526357c83512deab0d17d87e1f25089d6c4bef309e8adcf55
BLAKE2b-256 checksum
How to use checksums
1d13b5f1d865aefb11500eec3d8ec17b61fb2a0eb851ffd5f5b0a7794b2ebd90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.17-cp311-cp311-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
07ea3dc4b0bb76ed388f90b0000a4c1cd4710bfe55acb98335daa960d4863cbd
BLAKE2b-256 checksum
How to use checksums
3eb041f7e3741caa045c4bc673a2a55dc7764a3129d35973008b0b4eb8fcb851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Release files / pyyescrypt-0.1.17-cp311-cp311-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.17-cp311-cp311-macosx_13_0_arm64.whl
Size 1.6 MB
Tags CPython 3.11 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
bf388d8f60ddd9dc35c08916edf1316f3324e4d82992116c5ecd349f399eaf85
BLAKE2b-256 checksum
How to use checksums
1e07f7381ae5504d1ccbe40d496065360de2a775413c45beaf117b573e9dd2e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.1.dev7+gf536ac5d0 CPython/3.12.3

Security for pyyescrypt 0.1.17

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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