Registry / auth-security / blake3

blake3

JSON →
library1.0.9pypypi✓ verified 27d ago

blake3-py provides high-performance Python bindings for the BLAKE3 cryptographic hash function, implemented in Rust. It offers a fast, secure, and modern hashing algorithm. The current version is 1.0.8, with releases typically driven by updates to the underlying Rust `blake3` crate, PyO3, or support for new Python versions.

pip install blake3
INSTALL
IMPORT
SIG · BLAKE3
B
blake3
auth-securitypythonv1.0.9
Install
1.8s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

blake3
import blake3

Demonstrates both one-shot hashing of a complete data block and incremental hashing for streaming data.

import blake3 # One-shot hashing data = b"Hello, BLAKE3!" hash_result = blake3.blake3(data).hexdigest() print(f"One-shot hash: {hash_result}") # Incremental hashing hasher = blake3.Hasher() hasher.update(b"First part. ") hasher.update(b"Second part.") incremental_hash = hasher.finalize().hexdigest() print(f"Incremental hash: {incremental_hash}")
Debug
Known issues
gotchaInstallation may require a Rust toolchain. While pre-built wheels are available for most common platforms and Python versions, if a suitable wheel is not found for your specific environment (OS, architecture, Python version), pip will attempt to build the library from source. This requires the Rust programming language and Cargo package manager to be installed on your system.
fix
Ensure Rust and Cargo are installed (e.g., via `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`) before attempting to install `blake3` if you encounter build errors.
affects: All
gotchaMinimum Supported Rust Version (MSRV) increases over time. For versions 1.0.7 and later, the MSRV is Rust 1.80. If you are building from source, an older Rust toolchain might lead to compilation failures.
fix
Update your Rust toolchain to version 1.80 or newer using `rustup update`.
affects: >=1.0.7
gotchaFor optimal performance and memory usage with large datasets, use `blake3.Hasher()` for incremental hashing. The `blake3.blake3()` function is designed for one-shot hashing of data that fits comfortably in memory. Repeated calls to `blake3.blake3()` on chunks of a large file will be inefficient compared to using the `Hasher` object.
fix
Initialize `hasher = blake3.Hasher()` and feed data chunks using `hasher.update(data_chunk)` before calling `hasher.finalize()`.
affects: All
breakingRunning code that attempts to use 'blake3.Hasher()' can result in an 'AttributeError: module 'blake3' has no attribute 'Hasher'' if the 'Hasher' object is not available. This usually indicates an incomplete or corrupted installation of the 'blake3' library, or a version-specific issue where 'Hasher' is not exposed. Although 'blake3.blake3()' might still function for one-shot hashes, the incremental 'Hasher' API will be unusable, causing application breakage.
fix
Ensure the 'blake3' library is fully and correctly installed. If building from source, verify your Rust toolchain is properly configured and up-to-date (refer to warning 0 and 1 for Rust-related issues). Consider reinstalling 'blake3' in a clean virtual environment or checking for environment-specific compilation problems.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'blake3'
The 'blake3' Python package is not installed in the current Python environment, or the environment where it's installed is not the one being used.
fix
Install the package using pip: `pip install blake3`
ModuleNotFoundError: No module named 'blake3.blake3'
This error often occurs when Python tries to find a submodule named 'blake3' within the 'blake3' package itself, which is typically due to an incorrect import statement, a corrupted installation, or a naming conflict (e.g., a local file named `blake3.py`).
fix
Ensure you are using the correct import statement `import blake3` or `from blake3 import blake3` as needed. If the issue persists, try reinstalling the package: `pip uninstall blake3` then `pip install blake3`. Also, check for any local Python files or folders named `blake3.py` or `blake3` that might be shadowing the installed package.
error: failed to compile blake3
This error indicates a problem during the compilation of the underlying Rust BLAKE3 library, often due to a missing or outdated Rust toolchain, a C compiler issue, or incompatibility with the current Python or OS environment, especially when pre-built wheels are not available.
fix
Install or update the Rust toolchain: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` followed by `rustup update`. Ensure a compatible C compiler (like GCC or Clang) is installed and accessible in your system's PATH. On Windows, installing 'Build Tools for Visual Studio' might resolve it.
TypeError: argument must be an object with the buffer protocol or an immutable bytes-like object, not str
The BLAKE3 hash function operates on byte sequences, but a Python string (`str`) was provided as input without explicit encoding.
fix
Encode the string to bytes before passing it to the BLAKE3 hasher, typically using UTF-8 encoding: `hasher.update(my_string.encode('utf-8'))`
ValueError: key must be exactly 32 bytes
When using BLAKE3's keyed hashing mode, the provided key must be precisely 32 bytes in length.
fix
Ensure the key passed to `blake3.blake3(key=...)` or `blake3.blake3(key_material=...)` is a bytes object of exactly 32 bytes. You can generate a random 32-byte key using `secrets.token_bytes(32)`.
Upgrade
Version history
1.0.9latest on PyPI · released Jun 22, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
23
OpenAI (training)
1
Resources
blake3 — pip install blake3 · libregistry