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) -> strreturns a modular-crypt yescrypt hash string (typically starts with$y$).verify_hash(password: str, hash_str: str) -> boolverifies 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.pyloads the shared library withctypesand exposes the Python APIsrc/pyyescrypt/_native/destination directory for the built shared librarytests/Python tests (ABI-level tests viactypes)
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.dylibon macOSsrc/pyyescrypt/_native/libyescrypt.soon 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:
- build a wheel
- install it into a clean venv
- import
pyyescryptand run the tests against the installed package data
License
See LICENSE.
Metadata
Release files for pyyescrypt 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyyescrypt-0.1.18.tar.gz | 23.9 kB | Without provenance | Details for pyyescrypt-0.1.18.tar.gz |
Built distributions (wheels)
Total release size: 19.3 MB
Release files / pyyescrypt-0.1.18.tar.gz
| Download URL | pyyescrypt-0.1.18.tar.gz |
|---|---|
| Size | 23.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9281c2c9650c892feb9a2c5d8c55da5c920934121a9422c2c935f85a3b2c34b6
|
|
BLAKE2b-256 checksum How to use checksums |
1edd18b70c74a1ab232c6c211d40a96b70d91e09735944b3028a2ce675d816de
|
| 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.18-cp314-cp314-musllinux_1_2_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
a74ae7b05ed98acfb41cd078ec53918f2a5fb055d875535bbee3a8e13d12025b
|
|
BLAKE2b-256 checksum How to use checksums |
0a1ca907c7068d2aa462f48f95167e2e7746df4c1938bd1e38d74228e8778c53
|
| 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.18-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
0baec85d7e1eae80c40f0d7d5fb84c3430bb5a944542b0df38a8b037f7a9c3c5
|
|
BLAKE2b-256 checksum How to use checksums |
52b4625cd005fa19f96f8a9e7c3bec90bcf59e6a49ce067cf7686bf17d242e87
|
| 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.18-cp314-cp314-macosx_13_0_arm64.whl
| Download URL | pyyescrypt-0.1.18-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 |
a87cae5924362028256a41a5cef089df0f14acecbdbd6efc239d38f403a4eeac
|
|
BLAKE2b-256 checksum How to use checksums |
d23303ecec884c9a7ae35f38ace21fe0e3a9d0323493e374689600ff0267dd20
|
| 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.18-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
cec1a314b33a525a539e210d8052b7e6409c664fccadf2ab85c4047ef79f7621
|
|
BLAKE2b-256 checksum How to use checksums |
b7e6d8edcc7f2ccdcd391b0300be785eecfaff927534c9f10497e959382fab24
|
| 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.18-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
2dfbd91ca2769962d56e92d83bca4bcd507a3d776b681b911cad8c84ad1e15d4
|
|
BLAKE2b-256 checksum How to use checksums |
1651348e51aa79fd32657c8e14c41d4bbedb6b63015f3804cbd706f4106985a6
|
| 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.18-cp313-cp313-macosx_13_0_arm64.whl
| Download URL | pyyescrypt-0.1.18-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 |
133a068d5b4d64814e526798df3e8b3a5b8fa61aac2dbea1cacc2f3683d8f36c
|
|
BLAKE2b-256 checksum How to use checksums |
3c2d469c73ca5775eac2c56b51f202303fa02f9187bb8733ae5f7495cbb53d9b
|
| 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.18-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
493e71b65df8048d44ec2a39e4a8f08b7418cc730411bf24b04fbf52f7918c37
|
|
BLAKE2b-256 checksum How to use checksums |
da56143d1a721513ffaba2989a320dd6f9f6042f16e9ad763e3d64a1ad3bda60
|
| 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.18-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
80205a53ab341c190d99729027aeffe1697cb77cbe8fb2e421c7be2e64d8279b
|
|
BLAKE2b-256 checksum How to use checksums |
757aa36dbe57f8473e6d42a787cf89b741ac4f2d543269be13fa2b198090badb
|
| 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.18-cp312-cp312-macosx_13_0_arm64.whl
| Download URL | pyyescrypt-0.1.18-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 |
e8a93e427f5b58f0837e8e24863f993d2bdc9aef5643ed119e996197ef71676b
|
|
BLAKE2b-256 checksum How to use checksums |
38548ed3cfcfd3e62fdc2eec1bda26c2e7ecf4fc085267ba62f85b568994e2c5
|
| 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.18-cp311-cp311-musllinux_1_2_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
5d6bb6e35b2589be120b676ce3bbee3a6c101b0cd7af52339fd8070cd7a5230a
|
|
BLAKE2b-256 checksum How to use checksums |
eb60eeb16efec0c77298adc3da5f1c721c0aed37514618017b68c4d3ef48b2c1
|
| 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.18-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | pyyescrypt-0.1.18-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 |
62f5d6e3d45163a79215d75051631d91b12f4ea0a4954d30b3dbafd81c5ac13c
|
|
BLAKE2b-256 checksum How to use checksums |
d8bf8f43144118e3ef0ac1fe27ac1158318cfadb04022025160cdd5aed571146
|
| 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.18-cp311-cp311-macosx_13_0_arm64.whl
| Download URL | pyyescrypt-0.1.18-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 |
9eab4e7ab4d12d1cc9304688f54dcde6ffe6ffb06973e47b0aca236124d22473
|
|
BLAKE2b-256 checksum How to use checksums |
7fccf39eadf1d6f1340f9636119620571bb1f58a15a7fe7efa39247f40c92e2d
|
| 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.18
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.