Skip to main content

blake3-py Actions Status PyPI version

Python bindings for the Rust blake3 crate, based on PyO3. This a proof of concept, not yet fully-featured or production-ready. See also the Soundness concerns below.

Example

import blake3

hash1 = blake3.blake3(b"foobarbaz").digest()

hasher = blake3.blake3()
hasher.update(b"foo")
hasher.update(b"bar")
hasher.update(b"baz")
hash2 = hasher.digest()

assert hash1 == hash2

print("The hash of 'hello world' is:",
      blake3.blake3(b"hello world").hexdigest())

If you've cloned the GitHub project, and you want to experiment with the scripts there, they work like this:

# Build the shared library first.
$ ./build.py

# Hash some input.
$ echo hello world | ./example.py
dc5a4edb8240b018124052c330270696f96771a63b45250a5c17d3000e823355

# Run the tests.
$ ./test.py

Installation

pip install blake3

As usual with Pip, you might need to use sudo or the --user flag with the command above, depending on how you installed Python on your system.

There are binary wheels available on PyPI for most environments, so most users do not need a Rust toolchain. If you're building the source distribution, or if a binary wheel isn't available for your environment, you will need the nightly Rust toolchain (required by PyO3). This project includes a rust-toolchain file, so rustup will install and invoke the nightly toolchain automatically.

Soundness

There are some fundamental questions about whether these bindings can be sound. Like the Python standard library's hash implementations, in order to avoid blocking other threads during a potentially expensive call to update(), we release the GIL. But that opens up the possibility that another thread might mutate, say, the bytearray we're hashing, while the Rust code is treating it as a &[u8]. That violates Rust's aliasing guarantees and is technically unsound. However, no Python hashing implementation that I'm aware of holds the GIL while it calls into native code. I need to get some expert opinions on this.

Features

Currently only basic hashing is supported, with the default 32-byte output size. Missing BLAKE3 features should be easy to add, though I'm not sure exactly what the API should look like. Missing features include:

  • variable-length output
  • an incremental output reader
  • the keyed hashing mode
  • the key derivation mode
  • optional multi-threading

Release files for blake3 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blake3 0.1.1
File Size Uploaded
blake3-0.1.1.tar.gz 7.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for blake3 0.1.1
File
blake3-0.1.1-cp38-none-win_amd64.whl CPython 3.8 none Windows x86-64 Details
blake3-0.1.1-cp38-none-win32.whl CPython 3.8 none Windows x86-32 Details
blake3-0.1.1-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
blake3-0.1.1-cp38-cp38-macosx_10_7_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.7+ x86-64 Details
blake3-0.1.1-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details
blake3-0.1.1-cp37-none-win32.whl CPython 3.7 none Windows x86-32 Details
blake3-0.1.1-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
blake3-0.1.1-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details
blake3-0.1.1-cp36-none-win_amd64.whl CPython 3.6 none Windows x86-64 Details
blake3-0.1.1-cp36-none-win32.whl CPython 3.6 none Windows x86-32 Details
blake3-0.1.1-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
blake3-0.1.1-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details
blake3-0.1.1-cp35-none-win_amd64.whl CPython 3.5 none Windows x86-64 Details
blake3-0.1.1-cp35-none-win32.whl CPython 3.5 none Windows x86-32 Details
blake3-0.1.1-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
blake3-0.1.1-cp35-cp35m-macosx_10_7_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.7+ x86-64 Details

Total release size: 13.3 MB

Release files / blake3-0.1.1.tar.gz

Download URL blake3-0.1.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ac49a44a4fb1cdac1594d9ee3c018df3ba1ae619d1bba97176f7743068f42f1c
BLAKE2b-256 checksum
How to use checksums
2ddca05a33955351ec90461bcd2a69fec8cb19438f7493a3f9fc2b18042cd61d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp38-none-win_amd64.whl

Download URL blake3-0.1.1-cp38-none-win_amd64.whl
Size 378.7 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
3dace9320409a421db276a00152dbd2c570c0fee938575ef7ca431abeec09987
BLAKE2b-256 checksum
How to use checksums
9df9342fcea773955cc38e618b3a907d861825b7f77f797b58e703feea6b6abd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp38-none-win32.whl

Download URL blake3-0.1.1-cp38-none-win32.whl
Size 365.7 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
2af7cf4834cb004a19e63c28ccdf6c6e24a25ba1bd6716717e70666924cc7325
BLAKE2b-256 checksum
How to use checksums
6e53cf3befd8d39a4169d362cfc96bbb7cacd73c78269996c5b22ad12fd4238e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp38-cp38-manylinux1_x86_64.whl

Download URL blake3-0.1.1-cp38-cp38-manylinux1_x86_64.whl
Size 2.0 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
3151a97d34544fe8a2831a015437b6887d010aa6a067f404269e3b85460232c3
BLAKE2b-256 checksum
How to use checksums
fd12e5a19b293b96b8806b60f6b0f3ebdedbfcfbdca6ea4c204dfd5df5b2a418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp38-cp38-macosx_10_7_x86_64.whl

Download URL blake3-0.1.1-cp38-cp38-macosx_10_7_x86_64.whl
Size 544.6 kB
Tags CPython 3.8 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
abb63ed4166307f21a06d79ffc8ad955e55a9a9e179fe822f67465f5195291c4
BLAKE2b-256 checksum
How to use checksums
9f9a5267f0e0df7389f5207480e53b9530d2af8e627877d83add3336e0f34731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp37-none-win_amd64.whl

Download URL blake3-0.1.1-cp37-none-win_amd64.whl
Size 378.7 kB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
b45e00a330056c1eea037ce8d8141f2a52e73bff432d1340c3ece4e41bb89f7a
BLAKE2b-256 checksum
How to use checksums
0b2649b8854ee54ec1fd68bce659364bbf44fdacb24b8696834fa993d33f8dfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp37-none-win32.whl

Download URL blake3-0.1.1-cp37-none-win32.whl
Size 365.8 kB
Tags CPython 3.7 Windows x86-32
SHA-256 checksum
How to use checksums
cd7fecfbf1f04a3f361a31297ad429b52eabda4b65797eadf0665569f44d0781
BLAKE2b-256 checksum
How to use checksums
9c7c08624ef785413c9da5632920076fb67b48dc0ac3bac3e07809e5536c048e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp37-cp37m-manylinux1_x86_64.whl

Download URL blake3-0.1.1-cp37-cp37m-manylinux1_x86_64.whl
Size 2.0 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
f63c1f3a4de18fc679538f1de209f2ce016e711769073e8f86762cbf48d96c5d
BLAKE2b-256 checksum
How to use checksums
df4ad3ddb40b0f57f38640c894cbd47012f5dce33c3978b1e5febc4d4ef1c270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL blake3-0.1.1-cp37-cp37m-macosx_10_7_x86_64.whl
Size 544.7 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
5072bb2252f7cc75acc04f97b6a8e47550662f16438daae293e9fac35d4b4bfc
BLAKE2b-256 checksum
How to use checksums
652c1873978f2f455f3175182096a0b07cba4c126419a3ad6ae6c5d6a03bab84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp36-none-win_amd64.whl

Download URL blake3-0.1.1-cp36-none-win_amd64.whl
Size 379.4 kB
Tags CPython 3.6 Windows x86-64
SHA-256 checksum
How to use checksums
388a404b0f6131ab4feac41cd9095daacadb779503369c78010625d8a16b39d4
BLAKE2b-256 checksum
How to use checksums
5ca899b1016874118e0a32fdab0ef1ca232e596309e8ed212a0396066d74731a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp36-none-win32.whl

Download URL blake3-0.1.1-cp36-none-win32.whl
Size 366.5 kB
Tags CPython 3.6 Windows x86-32
SHA-256 checksum
How to use checksums
ee7099705c0d12c2d5e22936eb09545083682f6b29abb0ea71778d1da1d1c6ca
BLAKE2b-256 checksum
How to use checksums
c759284bf94d70f1284fea231e129ece82af6a729415f3ebb7fe0f5fdc1a12a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp36-cp36m-manylinux1_x86_64.whl

Download URL blake3-0.1.1-cp36-cp36m-manylinux1_x86_64.whl
Size 2.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
85aa65f6f602105182a9c39e6f9797ee447a07f66a727da122ba929b13a4cd1b
BLAKE2b-256 checksum
How to use checksums
f13193f7ad590d71c64be358bccd1b6012c3070695dcd81380677511bbeccbec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp36-cp36m-macosx_10_7_x86_64.whl

Download URL blake3-0.1.1-cp36-cp36m-macosx_10_7_x86_64.whl
Size 545.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
b8fe4883cee5b468ae1bae8c7f5fc7be5063b1cde5988801fb2d5348cd508a51
BLAKE2b-256 checksum
How to use checksums
02a965e4ad357084cfa9fee012a0f46880e837f1610a7845ae8f77ab1e23951d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp35-none-win_amd64.whl

Download URL blake3-0.1.1-cp35-none-win_amd64.whl
Size 379.4 kB
Tags CPython 3.5 Windows x86-64
SHA-256 checksum
How to use checksums
461cb5986153a6ba0a8303bf11e073f41e456d22f0e5453f86157f7e1142f536
BLAKE2b-256 checksum
How to use checksums
00875ed45466462064ca9769d9b700af8593f6a6df09a09fb90e043173b0d3f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp35-none-win32.whl

Download URL blake3-0.1.1-cp35-none-win32.whl
Size 366.6 kB
Tags CPython 3.5 Windows x86-32
SHA-256 checksum
How to use checksums
3ebe617d4018f611cf8d9b7bd92e3c3a7b759fd4a2edcb73b3752d452814b3b3
BLAKE2b-256 checksum
How to use checksums
1d8e13bf268d1f43e759422b6e4fe5bbf26b77ccd8d57f1338575dd5e173c0dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp35-cp35m-manylinux1_x86_64.whl

Download URL blake3-0.1.1-cp35-cp35m-manylinux1_x86_64.whl
Size 2.0 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
682e7761ab1081b026339639c80ca23d7d02d048a20624cb0e4cb55522b2606f
BLAKE2b-256 checksum
How to use checksums
61a53f7f359a8b5740cecd7f25f93043888aa6f1c9ad3c885c2c0fca8e9069fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / blake3-0.1.1-cp35-cp35m-macosx_10_7_x86_64.whl

Download URL blake3-0.1.1-cp35-cp35m-macosx_10_7_x86_64.whl
Size 545.2 kB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
b3b1c748ba8ff6a8dcc3c408bb6a28dd86ed70dbe16461a7fd199576a9d26385
BLAKE2b-256 checksum
How to use checksums
a3f850b3e2234d1af4ddfc8f403fe367a11831d51ead9d275e1d4ee3a323f3b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
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