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

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

Built distributions (wheels)

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

Total release size: 19.3 MB

Release files / pyyescrypt-0.1.16.tar.gz

Download URL pyyescrypt-0.1.16.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3d1637c6b0cf634da490c6293c646cf596cb9fc0aa2d755ea13214335bf4517e
BLAKE2b-256 checksum
How to use checksums
e8381ccbb1630820868ca2d4d188b2549efcc124c03eb24b8cf904ae1e1c9bf2
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.16-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.16-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
dfa5a81685ee7bfdbdfbb6c38c59ac0f1cfb1e50d182d4342291259454b8b854
BLAKE2b-256 checksum
How to use checksums
d4262fca1ec5e9e22fe9757676687c64056c32b2a06617f5811a82658b117352
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.16-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.16-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
2fb3eeddd180848f174f899a90513b4895b094cd810d7dffce4c28871212a7c4
BLAKE2b-256 checksum
How to use checksums
c5086635fb61f229bbcadac13460cefb5e072063edeaf618046c883a4dd9f162
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.16-cp314-cp314-macosx_12_0_arm64.whl

Download URL pyyescrypt-0.1.16-cp314-cp314-macosx_12_0_arm64.whl
Size 1.6 MB
Tags CPython 3.14 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
432bc8fb134886a9194053157fa90ea53edb891a833126eddab94a1a2ed5a562
BLAKE2b-256 checksum
How to use checksums
0a5aa0ec9b27fae519ca26d45b66ab367abcfefc387d71b97568dd40c32a36cc
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.16-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.16-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
fe8415331af16f9f04ca49a0c0305f284f556bd7f1c30b8ed317dd99e81354e1
BLAKE2b-256 checksum
How to use checksums
6392c2b49dcc3813d80921d598990d894a8f88883ce551d731c8bd0cbd16b8d9
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.16-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.16-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
58dac4b02613cb1ebe5b9419b9d756b801c9668927d292968cb599bd6480bbb9
BLAKE2b-256 checksum
How to use checksums
5d6e9c69a27db7c1c732109bf32bc0f49de30b82096579caa004ce73ce356765
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.16-cp313-cp313-macosx_12_0_arm64.whl

Download URL pyyescrypt-0.1.16-cp313-cp313-macosx_12_0_arm64.whl
Size 1.6 MB
Tags CPython 3.13 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
7ac07e6d13fba923a3bd61a53875d44b06d6d9b92213611239d372cbd93a5677
BLAKE2b-256 checksum
How to use checksums
adf9fe66933ca985caa4afe05f96b27a28c5591d4e479873a8282a2dfe175d75
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.16-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.16-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
b72c97ac6bbb50ce1f59b0dabea048cc92048d1dae04ffa3bfde7acb5f185960
BLAKE2b-256 checksum
How to use checksums
3f020ec2bb83042fc7c58c1d5c325544b72a6c499e6b101a7d1d29efee72f535
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.16-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.16-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
49fb17e629db73342753ad7aab1c747b39db521fb7f322cf9d784ec706a90017
BLAKE2b-256 checksum
How to use checksums
3045cf7634cea6d9b780d97b7de6ec9a459587728a0a519801366fa690ca37bc
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.16-cp312-cp312-macosx_12_0_arm64.whl

Download URL pyyescrypt-0.1.16-cp312-cp312-macosx_12_0_arm64.whl
Size 1.6 MB
Tags CPython 3.12 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
5fef7c7a9e37174d1f8235cc05faef9d478301aa2c174f9ad30ac9e1ea4df718
BLAKE2b-256 checksum
How to use checksums
1ba7c9c12ee880e22ec41d777e99313c2ae906b532e91839d7f1709e9148abe4
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.16-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL pyyescrypt-0.1.16-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
d6eff0cca1308ae667ac9b31068f43b402578f82c9f69ff22ed0fb8632c7527f
BLAKE2b-256 checksum
How to use checksums
4a9d06c5472b38de4f4e20b5306eee664ed20691b38eb7b84a2dc90afeffd970
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.16-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL pyyescrypt-0.1.16-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
caaff351b4e1575e824107b80b0f37ba263423533607fbe9713a47646ee47b57
BLAKE2b-256 checksum
How to use checksums
544ce13bef2315518d8ebaad0ea34a21068983bff56d2e3c84d0eed24c227e18
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.16-cp311-cp311-macosx_12_0_arm64.whl

Download URL pyyescrypt-0.1.16-cp311-cp311-macosx_12_0_arm64.whl
Size 1.6 MB
Tags CPython 3.11 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
1de11ad63da0695f2adb390db89b01e02f6e53fbbdf49b3940663604b642aaed
BLAKE2b-256 checksum
How to use checksums
04a81cedce0973e0a485d2dabf5d1d7a32520acd2085505d1aab92f1634b94a1
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.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.

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