Skip to main content

Bindings for whirlpool hash reference implementation.

Project description

python-whirlpool

CI License: Unlicense

The Whirlpool algorithm is designed by Vincent Rijmen and Paulo S.L.M. Barreto. It is a secure and modern digest function that has been recommended by the NESSIE project and adopted in the ISO/IEC 10118-3 international standard.

Digest functions, also known as hash functions, produce fixed-length output (a digest or hash) from a variable-length message. They are designed to be a one-way function.

This library is a Python wrapper around the Whirlpool C reference implementation. The Whirlpool reference implementations are public domain, as is this code.

The first version of the wrapper was written by James Cleveland with help from #python on irc.freenode.net.

Later on, the wrapper was rewritten by Olaf Conradi to use the hashlib interface and he made the library compatible with Python 3.

Installation

This library is available on PyPI.

pip install whirlpool

Usage

This is the same interface provided by the other digest algorithms in Python's hashlib.

import whirlpool

wp = whirlpool.new("My String")
hashed_string = wp.hexdigest()

wp.update("My Salt")
hashed_string = wp.hexdigest()

Starting with Python 3 text strings (as shown above) are stored as unicode. You need to specify the encoding of these strings before hashing.

wp = whirlpool.new(data.encoding('utf-8'))

Strings that are marked as binary do not need encoding.

Development

The source code is available on GitHub.

git clone https://github.com/oohlaf/python-whirlpool.git
cd python-whirlpool

Install in development mode using:

pip install -e .

Testing

This module is tested using Python 2.7, PyPy, and Python 3.9 and up.

You can run the test suite locally with:

python -m unittest discover -s test -p 'test_*.py'

For a multi-version local test matrix, you can also use:

tox

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

whirlpool-1.1.2.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whirlpool-1.1.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl (76.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file whirlpool-1.1.2.tar.gz.

File metadata

  • Download URL: whirlpool-1.1.2.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for whirlpool-1.1.2.tar.gz
Algorithm Hash digest
SHA256 29262e58347060c83209a3a1773b42aa81da38b32e5a700a3755e821c2f9d31b
MD5 4c05213ebdf0354577abf9a1062f6d9f
BLAKE2b-256 aaeb4e3b69a95dfcaba5166f63638456f80a1cf65eef2a0a79a461c2b4f32ae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for whirlpool-1.1.2.tar.gz:

Publisher: ci.yml on oohlaf/python-whirlpool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file whirlpool-1.1.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for whirlpool-1.1.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 545e09a97c65aa35954588a95c1a7b79b41ea5809df9c82a88f6eb6fe56bcd22
MD5 6160f1efa3d8a2ccacd2030a634739bc
BLAKE2b-256 83068d8d5e20fd0939254b23fd88841c517d508dda736315de9ca9774fa81061

See more details on using hashes here.

Provenance

The following attestation bundles were made for whirlpool-1.1.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl:

Publisher: ci.yml on oohlaf/python-whirlpool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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