Skip to main content

python-whirlpool

Travis CI Build Status AppVeyor Build Status 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 as 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:

python setup.py develop

Or install in editable mode using pip:

pip install -e .

Testing

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

You can run the test suite using

python setup.py test

Whirlpool Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

1.0.0 (2018-02-19)

Added

  • Port to Python 3.
  • Added PyPy support. PyPy3 does not work due to functions that have not yet been ported (like missing PyUnicode_New).
  • Added Continuous Integration using Travis CI and AppVeyor.
  • Added automatic upload to PyPI for successful build tags. Proper vX.Y.Z style tags upload to production PyPI, any other build (including .devX appended) upload to Test PyPI.

Fixed

  • Fix struct function declaration prototype warnings.
  • Fix pointer warnings.

Changed

Deprecated

  • Removed the old deprecated hash() interface.

0.3 (2013-01-23)

Added

  • Added the same interface as other Python digest algorithms have (like the default hashlib module).

Changed

  • Created proper unit tests.

Deprecated

  • The hash() function is deprecated. Please transition to the hashlib interface and use new() and hexdigest().

0.2 (unreleased)

  • This release was skipped.

0.1 (2011-05-18)

Added

  • Initial commit by James Cleveland.

Metadata

Release files for whirlpool-py311 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 whirlpool-py311 1
File Size Uploaded
whirlpool-py311-1.tar.gz 42.0 kB Details

Release files / whirlpool-py311-1.tar.gz

Download URL whirlpool-py311-1.tar.gz
Size 42.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a00503968ed9f14bf20151c7f0e465934bdcb04b61bfc8d6db4d35906948439e
BLAKE2b-256 checksum
How to use checksums
0fef7c5bdb00b0e7b0b0842998a9a1c20ed421c1ee2dc13f94cfcfe8580466a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1 This release

1 release file

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