{"id":1401,"library":"blake3","title":"BLAKE3 Hash Function","description":"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.","status":"active","version":"1.0.8","language":"en","source_language":"en","source_url":"https://github.com/oconnor663/blake3-py","tags":["cryptography","hashing","security","blake3","rust"],"install":[{"cmd":"pip install blake3","lang":"bash","label":"Install blake3"}],"dependencies":[],"imports":[{"symbol":"blake3","correct":"import blake3"}],"quickstart":{"code":"import blake3\n\n# One-shot hashing\ndata = b\"Hello, BLAKE3!\"\nhash_result = blake3.blake3(data).hexdigest()\nprint(f\"One-shot hash: {hash_result}\")\n\n# Incremental hashing\nhasher = blake3.Hasher()\nhasher.update(b\"First part. \")\nhasher.update(b\"Second part.\")\nincremental_hash = hasher.finalize().hexdigest()\nprint(f\"Incremental hash: {incremental_hash}\")\n","lang":"python","description":"Demonstrates both one-shot hashing of a complete data block and incremental hashing for streaming data."},"warnings":[{"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.","message":"Installation 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.","severity":"gotcha","affected_versions":"All"},{"fix":"Update your Rust toolchain to version 1.80 or newer using `rustup update`.","message":"Minimum 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.","severity":"gotcha","affected_versions":">=1.0.7"},{"fix":"Initialize `hasher = blake3.Hasher()` and feed data chunks using `hasher.update(data_chunk)` before calling `hasher.finalize()`.","message":"For 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.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}