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.0.tar.gz (39.8 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.0-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.0.tar.gz.

File metadata

  • Download URL: whirlpool-1.1.0.tar.gz
  • Upload date:
  • Size: 39.8 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.0.tar.gz
Algorithm Hash digest
SHA256 a48d931b0725467afc88c027e4e712e106bc6cd2aa636151cfe72975a7832826
MD5 4b6402b563665ff81fe9eaab3ad26901
BLAKE2b-256 a57b2209ff235df8ad2aa1ab171a072830828877ea97e64d388c6c2ed07a169c

See more details on using hashes here.

Provenance

The following attestation bundles were made for whirlpool-1.1.0.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.0-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.0-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 81e2ff4a51cc94e1ad1b1514128957459dde69fa515f334bc8e63ce05019cba8
MD5 abade15159177af8902a24c44694ee48
BLAKE2b-256 6d5e29484c103d7fc582b13af95a0d44eeb258a420d93a26dee812e001008043

See more details on using hashes here.

Provenance

The following attestation bundles were made for whirlpool-1.1.0-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