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

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.19
File Size Uploaded Provenance Actions
pyyescrypt-0.1.19.tar.gz 23.9 kB Without provenance Details for pyyescrypt-0.1.19.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyyescrypt 0.1.19
File Actions
pyyescrypt-0.1.19-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.19-cp314-cp314-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.19-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.19-cp314-cp314-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.19-cp314-cp314-macosx_13_0_arm64.whl CPython 3.14 CPython 3.14 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.19-cp314-cp314-macosx_13_0_arm64.whl
pyyescrypt-0.1.19-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.19-cp313-cp313-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.19-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.19-cp313-cp313-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.19-cp313-cp313-macosx_13_0_arm64.whl CPython 3.13 CPython 3.13 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.19-cp313-cp313-macosx_13_0_arm64.whl
pyyescrypt-0.1.19-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.19-cp312-cp312-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.19-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.19-cp312-cp312-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.19-cp312-cp312-macosx_13_0_arm64.whl CPython 3.12 CPython 3.12 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.19-cp312-cp312-macosx_13_0_arm64.whl
pyyescrypt-0.1.19-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.19-cp311-cp311-musllinux_1_2_x86_64.whl
pyyescrypt-0.1.19-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.19-cp311-cp311-manylinux_2_34_x86_64.whl
pyyescrypt-0.1.19-cp311-cp311-macosx_13_0_arm64.whl CPython 3.11 CPython 3.11 macOS 13.0+ ARM64 Details for pyyescrypt-0.1.19-cp311-cp311-macosx_13_0_arm64.whl

Total release size: 19.3 MB

Release files / pyyescrypt-0.1.19.tar.gz

Download URL pyyescrypt-0.1.19.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
45c7b44d0c7cdb88b838c45c49655505bf4ddf776b2981cea432db04d383eb52
BLAKE2b-256 checksum
How to use checksums
6edf0d654c6c800af3d88a123d04bf4413995fe0bcc25cd7a74a31d6fc29eb0e
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.19-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.19-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
2c52311a6c1197385a54ded06f40f1467c04cc77ff5ec20dc8bb27e92385cd44
BLAKE2b-256 checksum
How to use checksums
1748a416673be4343424882b3c9de3324ace5f39281640a24989c2f996270e1e
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.19-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.19-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
da3c26fffa728b6eb4e000636809aed18ab6e18015936b97987ab49ddc934776
BLAKE2b-256 checksum
How to use checksums
6755b12a671820d11fb32fa1fb0ec2f6567ebc6311ce3d5dd409659c5d092058
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.19-cp314-cp314-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.19-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
a03eb3842096d05ca0a8f7d0cd6273327d5cb98b1c101cc4b77eecba89ebb00d
BLAKE2b-256 checksum
How to use checksums
39b7784c12ba5fd3a4d4eaeb0e574ef2a46269b6bb502ab6cbcca3223090140d
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.19-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.19-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
c516fbad8f9ff817b30456753f9ea47eb4f4002e6d83c3253ac35aefd6bcfe78
BLAKE2b-256 checksum
How to use checksums
37fd2b4d8f413aab516562f9059c89980e2bab22fa5039849d60df5a87cdf18c
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.19-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.19-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
71b0d56f061c647038e5c151c0ddd32011d565f584cf4148c32f71d86feb76ee
BLAKE2b-256 checksum
How to use checksums
81532f7f29b7a18b73de8af53bf50935699f77278903c9fcca8caca25152a5fa
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.19-cp313-cp313-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.19-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
1b854002304909433cb40b83ecb2748e4f193b33d7b146a0da5a0859b0067959
BLAKE2b-256 checksum
How to use checksums
04a39fec393b27b096563e6775dd9dbc629f53de3303a3306188d0119cb0ca30
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.19-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.19-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
08289e880e55e7ab8ebd0ac9631d92d4dc6f4ac09c9d59741b22117c631cf93b
BLAKE2b-256 checksum
How to use checksums
648dd886477fe2c4ee7570e80b9c83e44cd9898c819a5d6da2acc23458c63ee2
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.19-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.19-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
40efa752280abea5a8cc716039fdc2cf58090277bf0890f2d0d69a8d38d6ba85
BLAKE2b-256 checksum
How to use checksums
d989a11355d4b4665f9f533a05cd7cef4f87f4e93cb282b4e722f45b96801688
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.19-cp312-cp312-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.19-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
d329227b69eecea4d594a2c819aed4e4952235afd3f292778d207ac61de9d6a0
BLAKE2b-256 checksum
How to use checksums
7e76111f01c5ab4eea4206a9b4c1c7851b0dce99743da7a15e1656d928e1d498
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.19-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.19-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
7edaa51fa6e11c573a827a4d0623f0f35c3ac8fd08a5e8bfff4014bef4b81a52
BLAKE2b-256 checksum
How to use checksums
c388e7727de06d3a829207ff70aefa0d063ee028d11105aa002a92c68ad7c210
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.19-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.19-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
8d2ba23b805c57673c75ecc0ff7a13053ddbf09d6a4c3ca2ae18472b0d8da066
BLAKE2b-256 checksum
How to use checksums
e2a4c719fabf4609cbb1d93ca0cbcee922dc2c5b67547632be247adf93b8c9c0
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.19-cp311-cp311-macosx_13_0_arm64.whl

Download URL pyyescrypt-0.1.19-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
2a26fe2b23fdf567812f9b9ff007b7604d9e638b1ba7ec39af48419956d19053
BLAKE2b-256 checksum
How to use checksums
0f6c65ae083e103e0272349141f98f2478a027c20d4b902bf5e18d417df84919
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.19

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