Archive for July, 2006

Whirlpool implementation for C and Ruby

MD5 is considered insecure these days, and I think SHA-1 is getting weak too. I remember reading an article on Slashdot that says SHA-1 has been “cracked”. Are there stronger hash algorithms? Yes there are, such as SHA-1, SHA-512 and Whirlpool. But they’re not well-supported: there are very few (good) libraries out there. For instance, PHP only has md5() and sha1().

Someone on IRC once said this: “sha makes you a puppet of the usa”. Yes IRC quotes aren’t exactly reliable, but I chose to use Whirlpool instead of SHA-512. Whirlpool has a sample implementation written in C. I took that sample implementation and turned it into something more useful.

Enter the Ruby Whirlpool library. This is a library for the Ruby language which implements the Whirlpool hashing algorithm, and the API is very simple. Most of the code is written in C, so it should be fast.

If you’re looking for a C library for Whirlpool, just download my Ruby library and copy & paste whirlpool-algorithm.[ch], whirlpool-constants.h and whirlpool-portability.h to your project. whirlpool-algorithm.h contains API documentation. The license is BSD.

I also have a Perl XS file. If you’re interested in using Whirlpool in Perl, just tell me and I can send you the XS file.

Comments