[issue39298] add BLAKE3 to hashlib

Jack O'Connor report at bugs.python.org
Tue Jan 11 18:47:28 EST 2022


Jack O'Connor <oconnor663 at gmail.com> added the comment:

Ah, good idea. I've published the new C implementation as: https://test.pypi.org/project/blake3-experimental-c/

You can install it with: pip install -i https://test.pypi.org/simple/ blake3-experimental-c

Despite the package name change, the extension module is still "blake3", so we still "import blake3" to get at it. For example:

    $ pip install -i https://test.pypi.org/simple/ blake3-experimental-c
    $ python
    >>> from blake3 import blake3
    >>> blake3(b"foo").hexdigest()
    '04e0bb39f30b1a3feb89f536c93be15055482df748674b00d26e5a75777702e9'
    >>> blake3(b"foo", max_threads=blake3.AUTO).hexdigest()
    '04e0bb39f30b1a3feb89f536c93be15055482df748674b00d26e5a75777702e9'

To run the Rust implementation's test suite against this implementation, you could then:

    $ pip install pytest numpy
    $ git clone https://github.com/oconnor663/blake3-py
    $ python -m pytest blake3-py/tests/test_blake3.py
    ===================== test session starts =====================
    platform linux -- Python 3.10.1, pytest-6.2.5, py-1.11.0, pluggy-0.13.1
    rootdir: /tmp
    collected 24 items

    blake3-py/tests/test_blake3.py ........................ [100%]

    ===================== 24 passed in 0.30s ======================

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39298>
_______________________________________


More information about the Python-bugs-list mailing list