Larry Bugbee, August 2006Whirlpool: a 512-bit hashing algorithm
Whirlpool is a hash function designed by Vincent Rijmen and Paulo Barreto and produces a message digest of 512 bits. Whirlpool has been selected for the NESSIE (EU) portfolio of cryptographic primitives, and has been included in the ISO/IEC 10118-3:2003(E) standard. There is a maximum file size limit, but it is huge. (2256 bits in length, or about 1.4*1067 GBytes. Huge.)
Barreto and Rijmen wrote reference implementations in both C and Java. I wrote a Python wrapper for the C version using ctypes. The Java version is a simple Java class implementation; it is not JCA/JCE compliant.
This implementation runs successfully on MacOSX (big endian PPC) versions 10.3.9 thru 10.4.7, Mandrake 10.1 (little endian AMD), Ubuntu 6.06, and Windows XP. The Windows version was compiled with gcc under MinGW. Python 2.4.x was used throughout. ctypes 0.9.6 or later is a prerequisite. ctypes is now part of the Python standard library as of Python 2.5.
The cryptography is based in part on techniques used in Rijndael (AES) and the Whirlpool algorithm has undergone two revisions since its original 2000 specification (v0). In the first revision in 2001 (v1) the randomly generated S-box was changed to one with better cryptographic properties and easier to implement in hardware. A second revision (v2) in 2003 changed the diffusion matrix. This implementation is based on the 2003 version, v2.
According to Barreto, Whirlpool is not (and will never be) patented. It may be used free of charge for any purpose. The reference implementations are in the public domain.
Note: THIS SOURCE IS PROVIDED WITHOUT WARRANTY OR GUARANTEE OF ANY KIND.
USE AT YOUR OWN RISK.
import whirlpool message = 'Kilroy was here' w = whirlpool.new() w.update(message) digest = w.final()Download:
source, demos, and precompiled binaries for
Python 2.4 Linux (PPC and x86), OSX, win32,