Skip to main content

Python bindings for the Rust blake3 crate

Project description

blake3-py Actions Status PyPI version

Python bindings for the official Rust implementation of BLAKE3, based on PyO3. These bindings expose all the features of BLAKE3, including extendable output, keying, and multithreading. The basic API matches that of Python's standard hashlib module.

Examples

from blake3 import blake3

# Hash some input all at once. The input can be bytes, a bytearray, or a memoryview.
hash1 = blake3(b"foobarbaz").digest()

# Hash the same input incrementally.
hasher = blake3()
hasher.update(b"foo")
hasher.update(b"bar")
hasher.update(b"baz")
hash2 = hasher.digest()
assert hash1 == hash2

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

# Use the keyed hashing mode, which takes a 32-byte key.
import secrets
random_key = secrets.token_bytes(32)
message = b"a message to authenticate"
mac = blake3(message, key=random_key).digest()

# Use the key derivation mode, which takes a context string. Context strings
# should be hardcoded, globally unique, and application-specific.
context = "blake3-py 2020-03-04 11:13:10 example context"
key_material = b"usually at least 32 random bytes, not a password"
derived_key = blake3(key_material, derive_key_context=context).digest()

# Extendable output. The default digest size is 32 bytes.
extended = blake3(b"foo").digest(length=100)
assert extended[:32] == blake3(b"foo").digest()
assert extended[75:100] == blake3(b"foo").digest(length=25, seek=75)

# Hash a large input using multiple threads. Note that this can be slower for
# inputs shorter than ~1 MB, and it's a good idea to benchmark it for your use
# case on your platform.
large_input = bytearray(1_000_000)
hash_single = blake3(large_input).digest()
hash_two = blake3(large_input, max_threads=2).digest()
hash_many = blake3(large_input, max_threads=blake3.AUTO).digest()
assert hash_single == hash_two == hash_many

# Copy a hasher that has already accepted some input.
hasher1 = blake3(b"foo")
hasher2 = hasher1.copy()
hasher1.update(b"bar")
hasher2.update(b"baz")
assert hasher1.digest() == blake3(b"foobar").digest()
assert hasher2.digest() == blake3(b"foobaz").digest()

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. But if you're building the source distribution, or if a binary wheel isn't available for your environment, you'll need to install the Rust toolchain.

C Bindings

Experimental bindings for the official BLAKE3 C implementation are available in the c_impl directory. These will probably not be published on PyPI, and most applications should prefer the Rust-based bindings. But if you can't depend on the Rust toolchain, and you're on some platform that this project doesn't provide binary wheels for, the C-based bindings might be an alternative.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blake3-0.3.3.tar.gz (116.4 kB view details)

Uploaded Source

Built Distributions

blake3-0.3.3-cp311-none-win_amd64.whl (207.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

blake3-0.3.3-cp311-none-win32.whl (225.6 kB view details)

Uploaded CPython 3.11 Windows x86

blake3-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

blake3-0.3.3-cp311-cp311-macosx_11_0_arm64.whl (333.2 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

blake3-0.3.3-cp311-cp311-macosx_10_7_x86_64.whl (357.6 kB view details)

Uploaded CPython 3.11 macOS 10.7+ x86-64

blake3-0.3.3-cp310-none-win_amd64.whl (207.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

blake3-0.3.3-cp310-none-win32.whl (225.6 kB view details)

Uploaded CPython 3.10 Windows x86

blake3-0.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

blake3-0.3.3-cp310-cp310-macosx_11_0_arm64.whl (333.2 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

blake3-0.3.3-cp310-cp310-macosx_10_7_x86_64.whl (357.6 kB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

blake3-0.3.3-cp39-none-win_amd64.whl (208.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

blake3-0.3.3-cp39-none-win32.whl (225.9 kB view details)

Uploaded CPython 3.9 Windows x86

blake3-0.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

blake3-0.3.3-cp39-cp39-macosx_11_0_arm64.whl (333.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

blake3-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl (357.9 kB view details)

Uploaded CPython 3.9 macOS 10.7+ x86-64

blake3-0.3.3-cp38-none-win_amd64.whl (207.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

blake3-0.3.3-cp38-none-win32.whl (226.0 kB view details)

Uploaded CPython 3.8 Windows x86

blake3-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

blake3-0.3.3-cp38-cp38-macosx_11_0_arm64.whl (333.4 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

blake3-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl (357.7 kB view details)

Uploaded CPython 3.8 macOS 10.7+ x86-64

blake3-0.3.3-cp37-none-win_amd64.whl (207.8 kB view details)

Uploaded CPython 3.7 Windows x86-64

blake3-0.3.3-cp37-none-win32.whl (225.9 kB view details)

Uploaded CPython 3.7 Windows x86

blake3-0.3.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

blake3-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl (357.8 kB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

File details

Details for the file blake3-0.3.3.tar.gz.

File metadata

  • Download URL: blake3-0.3.3.tar.gz
  • Upload date:
  • Size: 116.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3.tar.gz
Algorithm Hash digest
SHA256 0a78908b6299fd21dd46eb00fa4592b259ee419d586d545a3b86e1f2e4d0ee6d
MD5 5477d22e9d8ae8e805f1f1d6303cd3f7
BLAKE2b-256 7e88271fc900d7e8f091601c01412f3eafb62c62a9ce98091a24a822b4c392c1

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp311-none-win_amd64.whl.

File metadata

  • Download URL: blake3-0.3.3-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 207.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 60b040b2cadc5308fd381fccec288b3a44e0a78d39fffa939da751c5044edb87
MD5 aceb7f7bf3f12455cadd18da4e687c80
BLAKE2b-256 477bba086536cc6de8e3ee79be9359200d60666819781e2df8a80b7f1a5f2f3e

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp311-none-win32.whl.

File metadata

  • Download URL: blake3-0.3.3-cp311-none-win32.whl
  • Upload date:
  • Size: 225.6 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp311-none-win32.whl
Algorithm Hash digest
SHA256 ac8a208102c0418953a747fb794789c2cf2e7c3111db72a51bbd2fe0d236bc0a
MD5 8fe2fe3bd99751208d3129affe39005b
BLAKE2b-256 e9c5f618563aca9e5cc135e406cd81aa07c78770a1bce342466f7f44d844de22

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccf773e9fa772d21ef60f643a6a346ea722bdc12d86453359db5f12fe7679022
MD5 2ce0aa288ed769333c13592ae047f2c4
BLAKE2b-256 1ce1d7ba90063ac69f251d301197de94c7201078c2b39fa6a719482a1d662ec1

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e04a8f3046cbb450d6ba6075e085fa624d52af0a8e6abdb03f2601244c8f3fb7
MD5 92c1c9269eaf5f171634c25543ffa007
BLAKE2b-256 447e4f039b5cfba572ee752f2c643341106a08753dcc13cf5e90f91e1740f110

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp311-cp311-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 7d3c62ec8aa4c3c21c72496fd0004862d8f7e1eeb69a574d0a8469d6c7f47ece
MD5 81c654da98dd0bc28f123009fdac8d35
BLAKE2b-256 e9396356fb8b8f7d365f08ffa5e40481effdfc4b243c69b26afa05d9d13e0072

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp310-none-win_amd64.whl.

File metadata

  • Download URL: blake3-0.3.3-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 207.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 e1724c115226c471f01d562e82f1f84c9d677b9c4ac13a0ece6c5be4928d4272
MD5 7bb3eddd1e65e5bba4a2e27de0c17061
BLAKE2b-256 2af493b8ae4190722402409ed0d46f8798bf2e0635e2cb7bfbbe976cec5e72e6

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp310-none-win32.whl.

File metadata

  • Download URL: blake3-0.3.3-cp310-none-win32.whl
  • Upload date:
  • Size: 225.6 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp310-none-win32.whl
Algorithm Hash digest
SHA256 97ccac1fe423d80e400f3172114fe09c430cb74442abd096592b7e4986960c55
MD5 daf0fa0cebac49eafefa49322385bba1
BLAKE2b-256 8c2886782d9445525c184126815a71df4c1066e8fed6d310b8be7f52b47fd808

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48ea05bbc964edbf1e4e9e5a4d9c2df50fa80a295c16f0cf51321eb6273d3b7d
MD5 212d86108bdf8ff32e1b8dc4a33cd1f7
BLAKE2b-256 d9594322578a872ce68b5daeff6cedfe816c5ab200004396b90374b552c142f9

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed2b9e4327fbe35897ddcf61b7874dd7d8de102234b86b8d6c4aff442cf3dc57
MD5 de8da401a1dbcb00fd898e4b6451f6e2
BLAKE2b-256 38ffd797368c692a7f3f60d2520824e76287e1350c267d8a93f129f7762ccefd

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 f6443ee7e80cff7936a0b68b8d9c482548a7bd29e463419a59bb3f1e67dcad35
MD5 ab8570fa47df0c60c5f0d29f1916207f
BLAKE2b-256 6665cfe35fa4e7e8c2bdec32f2159e2161594580a7bb22456d315dbacb62255e

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp39-none-win_amd64.whl.

File metadata

  • Download URL: blake3-0.3.3-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 208.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 320c3a046d2d931a022900b9272ae4e625d1c5761740dbf4072b65401b73531d
MD5 ad588656b0ea196969292986cb1bb923
BLAKE2b-256 d1bfa778260a43a9edcd70a11db40d24cd888001aa625fcbe8fcc37c26ac1e4e

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp39-none-win32.whl.

File metadata

  • Download URL: blake3-0.3.3-cp39-none-win32.whl
  • Upload date:
  • Size: 225.9 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp39-none-win32.whl
Algorithm Hash digest
SHA256 ef8865081fcbbeee3d536a62b4ba2a7b8b41d6479c88d7c6da0cd68a24ca9be2
MD5 a3e679d56140cd465c620da23c0313a6
BLAKE2b-256 7f752fff3cd46b6515cd7159616cdcddd28343a0898fe04473c8d36b4a06ff3e

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8299a67e7c81ae28815192bc99b0eaaf02857a73e18209e3c763b16defd35ce9
MD5 2522b8d99e508bb50b3d8c9debe7f8c1
BLAKE2b-256 7f46760281c63a0ac3a119834957d40b0ab45d1311d29da910c8932184243199

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e3324a793c4771a77a3640c2a0512b456666c2bc43e0b8c651b8fd488fb56404
MD5 a24ac7a68b8be0ab2ab1dd220f538dd0
BLAKE2b-256 4b913ea7fe431c322440b60d80205c985a40f01d2c6b49e8a8bfdb583dab6bdd

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 6293cc474af332bb3a99d93d2395a92cb7945707749eb52e7729dd85c0097275
MD5 488412b3ab67e6724ea0542ad81cb3fc
BLAKE2b-256 37c219bd86bfcfc533e58cb003657dbff9963eb91a2570d57099e0f1ae329037

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp38-none-win_amd64.whl.

File metadata

  • Download URL: blake3-0.3.3-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 207.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 0d9d9d25fca5f65940c780693500e85db57f10b3281153af7a965dbed094546a
MD5 24318b3b2a846723200b7d35dd5e7bec
BLAKE2b-256 db09eb7d8b3e15e750192c9b0dec19ca95c1bc3d24bd3ae173ab1cfd713521cf

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp38-none-win32.whl.

File metadata

  • Download URL: blake3-0.3.3-cp38-none-win32.whl
  • Upload date:
  • Size: 226.0 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp38-none-win32.whl
Algorithm Hash digest
SHA256 6a72458e712c511bdc0eb88de79c992977c79194806e9892f2c1b3f6902d85a2
MD5 11a5aa46007b96711b0ae3a8739022c3
BLAKE2b-256 6507391c4e9517d30f8e26937daae828abe510b1dd7d9727b97509d5abe08acd

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c13bf3c30f843d2de05d0a4f5f705611307bebdc4b81b33555a220e0131f103
MD5 43c84028714662c9d2b32092188d9f54
BLAKE2b-256 951595c3dd9d443a9ed5ae3a51793cf01c00afc05c7269ed7b9ad2e371a97981

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2fb9ba8edc59ad889aa8352b39ae5e254fe1a466a9031635ce38f97df78be6f
MD5 4c347620fd53ef8b892f43349b0def31
BLAKE2b-256 144ab2f89d8a8581efcc62499dd9a3f19015539a281a5f48d42d50fc68a1efb7

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 f3363e23a385feb67a845a2b87a1dde6aa952bae5b34189bf9a674fbc2431565
MD5 b8035cb39dc94e529b3cfb0fd54972d2
BLAKE2b-256 91b364233ba049467ce59229e06885a3e6a76a7a8407f81fc7e993a423c16e8d

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp37-none-win_amd64.whl.

File metadata

  • Download URL: blake3-0.3.3-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 207.8 kB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 89e084b0a5967bcd949a8bb75c4fe40562b59c170fe6aca92acb5de4fc4e97ca
MD5 8358783ebdcf9dbf9629bda6323c308a
BLAKE2b-256 19f4736ef4df85365beb5716ffe972f28893c78728bcae8edab1a551b3262fbc

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp37-none-win32.whl.

File metadata

  • Download URL: blake3-0.3.3-cp37-none-win32.whl
  • Upload date:
  • Size: 225.9 kB
  • Tags: CPython 3.7, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for blake3-0.3.3-cp37-none-win32.whl
Algorithm Hash digest
SHA256 08f3122ddd4345cbcc83fa1acc8287f2dfb449d77036f73967d56b96dfc919e6
MD5 49ef1f095560ccfdcdbbab2762d78f22
BLAKE2b-256 0be7021c33f7693f72c1c292d5cabe0f4f9c2b4d8193aed2ad8c362fdda9d451

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8265bf4846371589f471b52281c54402853e9bb95bfb160bab38ab8839734ac4
MD5 9cfb4f528cf55faaa24a864cb3c0ce23
BLAKE2b-256 949011040c04a0000725fc192ce5bae9653f7ddcd20a80ab448d7c229b421366

See more details on using hashes here.

File details

Details for the file blake3-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for blake3-0.3.3-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 69269ac2777ea5082e01558ebb9d7d354672414d56de3955c8dada4846192bc4
MD5 bc7ac6f30e0b4ff848e332497d2698b9
BLAKE2b-256 82ca604c072baa71b28cb7e9b14cfa18fdb2b0a3ee2cc72f1ea16ca505a2d5d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page